예제 #1
0
        private void _transportChannel_Closed(object sender, TransportChannelClosedEventArgs e)
        {
            _transportChannel.MessageReceived -= _transportChannel_MessageReceived;
            _transportChannel.Closed -= _transportChannel_Closed;

            OnTransportChannelClosed();
        }
예제 #2
0
        void TransportChannelClosed(object sender, TransportChannelClosedEventArgs e)
        {
            ((AsyncTransportChannel)sender).Closed -= TransportChannelClosed;

            // Put the SocketAsyncEventArg back into the pool,
            // to be used by another client. This
            this._poolOfReceiveEventArgs.Push(e.ReceiveEventArgs);
            this._poolOfSendEventArgs.Push(e.SendEventArgs);

            // decrement the counter keeping track of the total number of clients
            //connected to the server, for testing
            //todo: decrease connected socket number variable

            //Release Semaphore so that its connection counter will be decremented.
            //This must be done AFTER putting the SocketAsyncEventArg back into the pool,
            //or you can run into problems.
            this._theMaxConnectionsEnforcer.Release();
            try
            {
                // Remove session from active sessions
                ActiveChannels.Remove((AsyncTransportChannel)sender);
            }
            catch (Exception)
            {

            }
        }
예제 #3
0
 private void _channel_Closed(object sender, TransportChannelClosedEventArgs e)
 {
     Channel.Closed -= new EventHandler<TransportChannelClosedEventArgs>(_channel_Closed);
     Terminate();
 }