/// <summary>
        /// Close the stream part
        /// </summary>
        /// <param name="ct"></param>
        /// <returns></returns>
        private async Task CloseStreamAsync(CancellationToken ct)
        {
            IConnection    connection = _connection;
            IMessageStream stream     = _stream;

            _connection = null;
            _stream     = null;
            try {
                await stream.SendAsync(new Message(_socket.Id, RemoteId,
                                                   new CloseRequest()), ct).ConfigureAwait(false);
            }
            finally {
                await connection.CloseAsync().ConfigureAwait(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Close the stream part
        /// </summary>
        /// <param name="ct"></param>
        /// <returns></returns>
        private async Task CloseStreamAsync(CancellationToken ct)
        {
            IConnection    connection = _connection;
            IMessageStream stream     = _stream;

            _connection = null;
            _stream     = null;
            try {
                ProxyEventSource.Log.StreamClosing(this, _stream);
                await stream.SendAsync(new Message(_socket.Id, RemoteId,
                                                   new CloseRequest()), ct).ConfigureAwait(false);
            }
            finally {
                await connection.CloseAsync().ConfigureAwait(false);

                ProxyEventSource.Log.StreamClosed(this, null);
            }
        }