Example #1
0
 public virtual void AbortOnError(C c)
 {
     lock (this._lockServer)
     {
         if (c != null)
         {
             this._handler.OnClose(c);
             base.RemoveConnection(c._sock);
             if (!c._sock.Connected)
             {
                 c._datasetRequestQueue.Clear();
                 c._curDispatchAttrib = null;
             }
             SessionAPI.Delete(c._uid, false);
             if (c._sslStream != null)
             {
                 c._sslStream.Dispose();
                 c._sslStream = null;
             }
             if (c._sock != null)
             {
                 Common.WriteLine("Socket Aborted: #" + c._sock.Handle, new string[0]);
                 if (c._sock.Connected)
                 {
                     c._sock.Shutdown(SocketShutdown.Both);
                     c._sock.Disconnect(false);
                 }
                 c._sock.Close();
             }
         }
     }
 }
Example #2
0
        protected void RemoveConnection(Socket sock)
        {
            long num = -1L;

            lock (this._lockServer)
            {
                if (this._connections.ContainsKey(sock))
                {
                    C c = this._connections[sock];
                    if (c != null)
                    {
                        num = c._uid;
                    }
                    this._connections.Remove(sock);
                    Interlocked.Decrement(ref this._connected);
                }
            }
            if (num > 0L)
            {
                SessionAPI.Delete(num, false);
            }
        }