protected override void DoClose() { TaskCompletionSource promise = this.connectPromise; if (promise != null) { // Use TrySetException() instead of SetException() to avoid the race against cancellation due to timeout. promise.TrySetException(ClosedChannelException); this.connectPromise = null; } IScheduledTask cancellationTask = this.connectCancellationTask; if (cancellationTask != null) { cancellationTask.Cancel(); this.connectCancellationTask = null; } SocketChannelAsyncOperation readOp = this.readOperation; if (readOp != null) { readOp.Dispose(); this.readOperation = null; } SocketChannelAsyncOperation writeOp = this.writeOperation; if (writeOp != null) { writeOp.Dispose(); this.writeOperation = null; } }
protected override void DoFinishConnect(SocketChannelAsyncOperation operation) { try { operation.Validate(); } finally { operation.Dispose(); } this.OnConnected(); }
protected override void DoFinishConnect(SocketChannelAsyncOperation operation) { try { operation.Validate(); } finally { operation.RemoteEndPoint = null; // cleanup after connect operation.Dispose(); } }