Esempio n. 1
0
 def _connect(self):
     ''' Connect first available epnt '''
     sock = utils_net.connect(self.epnts.popleft(), self.prefer_ipv6)
     if sock:
         self.sock = sock
         self.timestamp = utils.ticks()
         self.poller.set_writable(self)
     else:
         self._connection_failed()
Esempio n. 2
0
    def connect(self, endpoint, conf):

        # Connect first address in a list
        if ' ' in endpoint[0]:
            LOG.debug('* Connecting to %s' % str(endpoint))
            for address in endpoint[0].split():
                epnt = (address.strip(), endpoint[1])
                self.epnts.append(epnt)
            endpoint = self.epnts.popleft()

        self.endpoint = endpoint

        sock = utils_net.connect(endpoint)
        if not sock:
            self._connection_failed()
            return

        self.sock = sock
        self.timestamp = utils.ticks()
        self.poller.set_writable(self)
Esempio n. 3
0
    def connect(self, endpoint, conf):

        # Connect first address in a list
        if ' ' in endpoint[0]:
            logging.debug('* Connecting to %s', str(endpoint))
            for address in endpoint[0].split():
                epnt = (address.strip(), endpoint[1])
                self.epnts.append(epnt)
            endpoint = self.epnts.popleft()

        self.endpoint = endpoint

        prefer_ipv6 = CONFIG["prefer_ipv6"]
        if conf and "prefer_ipv6" in conf:
            prefer_ipv6 = conf["prefer_ipv6"]
        sock = utils_net.connect(endpoint, prefer_ipv6)
        if not sock:
            self._connection_failed()
            return

        self.sock = sock
        self.timestamp = utils.ticks()
        self.poller.set_writable(self)