//
        // Close and dispose of the socket
        //
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }
            if (_cleanedUp)
            {
                return;
            }
            lock (this) {
                if (!_cleanedUp)
                {
                    if (Connected)
                    {
                        Close();
                    }

                    _internal?.Dispose();
                    _internal = null;

                    _cleanedUp = true;
                }
            }
        }
Ejemplo n.º 2
0
 //
 // Create socket for address family
 //
 internal Socket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType, IProxySocket internalSocket)
 {
     this._internal   = internalSocket;
     this.Connected   = false;
     this.IsBound     = false;
     this.IsListening = false;
 }
 //
 // Create socket for address family
 //
 public Socket(AddressFamily addressFamily, SocketType socketType,
               ProtocolType protocolType, uint keepAlive, IProxySocketFactory factory = null)
 {
     if (factory == null)
     {
         factory = new ProxySocketFactory();
     }
     _internal = factory.Create(addressFamily, protocolType, socketType, keepAlive);
 }
 //
 // Create socket for address family
 //
 public Socket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType, uint keepAlive)
 {
     _internal = ProxySocket.Create(new SocketInfo {
         Family   = addressFamily,
         Protocol = protocolType,
         Type     = socketType,
         Timeout  = keepAlive
     }, Provider);
 }
Ejemplo n.º 5
0
 //
 // Close and dispose of the socket
 //
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
     {
         return;
     }
     if (_cleanedUp)
     {
         return;
     }
     _cleanedUp = !Connected;
     if (!_cleanedUp)
     {
         try {
             Close();
         }
         catch { }
         _cleanedUp = true;
     }
     _internal = null;
 }
 //
 // Create socket for address family
 //
 internal Socket(IProxySocket internalSocket)
 {
     _internal = internalSocket;
 }
Ejemplo n.º 7
0
 //
 // Called by the class to create a socket to accept an incoming request.
 //
 internal Socket(Socket original, IProxySocket internalSocket) :
     this(original.AddressFamily, original.SocketType, original.ProtocolType, internalSocket)
 {
 }
Ejemplo n.º 8
0
 public ProxyCheck(ProxyPoolContext dbContext, IProxySocket socket, IRandomPool randomPool)
 {
     _dbContext  = dbContext;
     _socket     = socket;
     _randomPool = randomPool;
 }