(self)
return sock_info
Get or create a SocketInfo. Can raise ConnectionFailure.
Get or create a SocketInfo. Can raise ConnectionFailure.
Get or create a SocketInfo . Can raise ConnectionFailure .
def _get_socket_no_auth(self):
        """Get or create a SocketInfo. Can raise ConnectionFailure."""
        # We use the pid here to avoid issues with fork / multiprocessing.
        # See test.test_client:TestClient.test_fork for an example of
        # what could go wrong otherwise
        if self.pid != os.getpid():
            self.reset()

        # Get a free socket or create one.
        if not self._socket_semaphore.acquire(
                True, self.opts.wait_queue_timeout):
            self._raise_wait_queue_timeout()
        with self.lock:
            self.active_sockets += 1

        # We've now acquired the semaphore and must release it on error.
        try:
            try:
                # set.pop() isn't atomic in Jython less than 2.7, see
                # http://bugs.jython.org/issue1854
                with self.lock:
                    # Can raise ConnectionFailure.
                    sock_info = self.sockets.pop()
            except KeyError:
                # Can raise ConnectionFailure or CertificateError.
                sock_info = self.connect()
            else:
                # Can raise ConnectionFailure.
                sock_info = self._check(sock_info)
        except:
            self._socket_semaphore.release()
            with self.lock:
                self.active_sockets -= 1
            raise

        return sock_info
def _get_socket_no_auth ( self ) : # We use the pid here to avoid issues with fork / multiprocessing. # See test.test_client:TestClient.test_fork for an example of # what could go wrong otherwise if self . pid != os . getpid ( ) : self . reset ( ) # Get a free socket or create one. if not self . _socket_semaphore . acquire ( True , self . opts . wait_queue_timeout ) : self . _raise_wait_queue_timeout ( ) with self . lock : self . active_sockets += 1 # We've now acquired the semaphore and must release it on error. try : try : # set.pop() isn't atomic in Jython less than 2.7, see # http://bugs.jython.org/issue1854 with self . lock : # Can raise ConnectionFailure. sock_info = self . sockets . pop ( ) except KeyError : # Can raise ConnectionFailure or CertificateError. sock_info = self . connect ( ) else : # Can raise ConnectionFailure. sock_info = self . _check ( sock_info ) except : self . _socket_semaphore . release ( ) with self . lock : self . active_sockets -= 1 raise return sock_info