private void CloseSocket(ProxySocketTun sock)
 {
     lock (this)
     {
         if (sock != null)
         {
             ProxySocketTun s = sock;
             try
             {
                 s.Shutdown(SocketShutdown.Both);
             }
             catch { }
             try
             {
                 s.Close();
             }
             catch { }
         }
     }
 }
예제 #2
0
 public void Close()
 {
     lock (this)
     {
         if (_closed)
         {
             return;
         }
         _closed = true;
     }
     ResetTimeout(0);
     Thread.Sleep(100);
     if (_remote != null)
     {
         try
         {
             _remote.Shutdown(SocketShutdown.Both);
             _remote.Close();
         }
         catch (SocketException e)
         {
             Logging.LogUsefulException(e);
         }
     }
     if (_local != null)
     {
         try
         {
             _local.Shutdown(SocketShutdown.Both);
             _local.Close();
         }
         catch (Exception e)
         {
             Logging.LogUsefulException(e);
         }
     }
 }