Esempio n. 1
0
        void Dispose(bool shutdown)
        {
            if (Interlocked.CompareExchange(ref _disposed, 1, 0) == 0)
            {
                try
                {
                    _writeEventArgs.Dispose();

                    if (shutdown && _socket.Connected)
                    {
                        _socket.Shutdown(SocketShutdown.Send);
                    }

                    _socket.Close();
                }
                finally
                {
                    _bufferManager.Return(ref _writeBuffer);
                }
            }
        }