public void Remove(SocketSession session)
        {
            ClearWriteRequestQueue(session);

            if (session.Socket.Connected)
            {
                try
                {
                    session.Socket.Shutdown(System.Net.Sockets.SocketShutdown.Send);
                }
                catch { /* the session has already closed */ }
            }
            session.Socket.Close();

            IoServiceSupport support = session.Service as IoServiceSupport;

            if (support != null)
            {
                try
                {
                    support.FireSessionDestroyed(session);
                }
                catch (Exception e)
                {
                    // The session was either destroyed or not at this point.
                    // We do not want any exception thrown from this "cleanup" code.
                    session.FilterChain.FireExceptionCaught(e);
                }
            }
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public void Remove(AsyncDatagramSession session)
        {
            SessionRecycler.Remove(session);
            IoServiceSupport support = session.Service as IoServiceSupport;

            if (support != null)
            {
                support.FireSessionDestroyed(session);
            }
        }
Esempio n. 3
0
        private void Remove(SerialSession session)
        {
            session.SerialPort.Close();
            IoServiceSupport support = session.Service as IoServiceSupport;

            if (support != null)
            {
                support.FireSessionDestroyed(session);
            }
        }
Esempio n. 4
0
 public void Remove(LoopbackSession session)
 {
     lock (session.Lock)
     {
         if (!session.CloseFuture.Closed)
         {
             IoServiceSupport support = session.Service as IoServiceSupport;
             if (support != null)
             {
                 support.FireSessionDestroyed(session);
             }
             session.RemoteSession.Close(true);
         }
     }
 }
Esempio n. 5
0
        public void Remove(SocketSession session)
        {
            ClearWriteRequestQueue(session);

            if (session.Socket.Connected)
            {
                try
                {
                    session.Socket.Shutdown(System.Net.Sockets.SocketShutdown.Send);
                }
                catch { /* the session has already closed */ }
            }
            session.Socket.Close();

            IoServiceSupport support = session.Service as IoServiceSupport;

            if (support != null)
            {
                support.FireSessionDestroyed(session);
            }
        }