public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state) { if (Interlocked.Decrement(ref this.referenceCount) == 0) { bool flag = true; try { List <OperationWithTimeoutBeginCallback> list = new List <OperationWithTimeoutBeginCallback>(3); List <OperationEndCallback> list2 = new List <OperationEndCallback>(3); if (this.securityProtocolFactory != null) { list.Add(new OperationWithTimeoutBeginCallback(this.securityProtocolFactory.BeginClose)); list2.Add(new OperationEndCallback(this.securityProtocolFactory.EndClose)); } if (this.sessionMode && (this.sessionSettings != null)) { list.Add(new OperationWithTimeoutBeginCallback(this.sessionSettings.BeginClose)); list2.Add(new OperationEndCallback(this.sessionSettings.EndClose)); } list.Add(new OperationWithTimeoutBeginCallback(this.innerListener.BeginClose)); list2.Add(new OperationEndCallback(this.innerListener.EndClose)); IAsyncResult result = OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, list.ToArray(), list2.ToArray(), callback, state); flag = false; return(result); } finally { if (flag) { this.AbortCore(); } } } return(new DummyCloseAsyncResult(callback, state)); }
public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state) { List <OperationWithTimeoutBeginCallback> list = new List <OperationWithTimeoutBeginCallback>(3); List <OperationEndCallback> list2 = new List <OperationEndCallback>(3); if (this.securityProtocolFactory != null) { list.Add(new OperationWithTimeoutBeginCallback(this.BeginOpenSecurityProtocolFactory)); list2.Add(new OperationEndCallback(this.EndOpenSecurityProtocolFactory)); } if (this.sessionMode && (this.sessionSettings != null)) { list.Add(new OperationWithTimeoutBeginCallback(this.sessionSettings.BeginOpen)); list2.Add(new OperationEndCallback(this.sessionSettings.EndOpen)); } list.Add(new OperationWithTimeoutBeginCallback(this.innerListener.BeginOpen)); list2.Add(new OperationEndCallback(this.innerListener.EndOpen)); return(OperationWithTimeoutComposer.BeginComposeAsyncOperations(timeout, list.ToArray(), list2.ToArray(), callback, state)); }
public void EndClose(IAsyncResult result) { if (result is DummyCloseAsyncResult) { DummyCloseAsyncResult.End(result); } else { bool throwing = true; try { OperationWithTimeoutComposer.EndComposeAsyncOperations(result); throwing = false; } finally { if (throwing) { AbortCore(); } } } }
public void EndOpen(IAsyncResult result) { OperationWithTimeoutComposer.EndComposeAsyncOperations(result); this.SetBufferManager(); }
public void EndOpen(IAsyncResult result) { OperationWithTimeoutComposer.EndComposeAsyncOperations(result); }