示例#1
0
        /// <summary>
        /// Called on libuv thread.
        /// </summary>
        internal virtual void OnSocketClosed()
        {
            if (_filteredStreamAdapter != null)
            {
                _filteredStreamAdapter.Abort();
                _rawSocketInput.IncomingFin();
                _readInputTask.ContinueWith((task, state) =>
                {
                    ((Connection)state)._filterContext.Connection.Dispose();
                    ((Connection)state)._filteredStreamAdapter.Dispose();
                    ((Connection)state)._rawSocketInput.Dispose();
                }, this);
            }
            else
            {
                _rawSocketInput.Dispose();
            }

            lock (_stateLock)
            {
                State = ConnectionState.SocketClosed;

                if (_socketClosedTcs != null)
                {
                    // This is always waited on synchronously, so it's safe to
                    // call on the libuv thread.
                    _socketClosedTcs.TrySetResult(null);
                }
            }

            // We're already in the libuv thread, simply abort the processing
            AbortProcessing();
        }
示例#2
0
 public void Dispose()
 {
     SocketInput.Dispose();
 }