(self)
return conn
Establish a socket connection and set nodelay settings on it.

        :return: New socket connection.
Establish a socket connection and set nodelay settings on it.
Establish a socket connection and set nodelay settings on it .
def _new_conn(self):
        """ Establish a socket connection and set nodelay settings on it.

        :return: New socket connection.
        """
        extra_kw = {}
        if self.source_address:
            extra_kw['source_address'] = self.source_address

        if self.socket_options:
            extra_kw['socket_options'] = self.socket_options

        try:
            conn = connection.create_connection(
                (self.host, self.port), self.timeout, **extra_kw)

        except SocketTimeout as e:
            raise ConnectTimeoutError(
                self, "Connection to %s timed out. (connect timeout=%s)" %
                (self.host, self.timeout))

        except SocketError as e:
            raise NewConnectionError(
                self, "Failed to establish a new connection: %s" % e)

        return conn
def _new_conn ( self ) : extra_kw = { } if self . source_address : extra_kw [ 'source_address' ] = self . source_address if self . socket_options : extra_kw [ 'socket_options' ] = self . socket_options try : conn = connection . create_connection ( ( self . host , self . port ) , self . timeout , * * extra_kw ) except SocketTimeout as e : raise ConnectTimeoutError ( self , "Connection to %s timed out. (connect timeout=%s)" % ( self . host , self . timeout ) ) except SocketError as e : raise NewConnectionError ( self , "Failed to establish a new connection: %s" % e ) return conn