Exemplo n.º 1
0
 def get_event_connection(self):
     logging.debug('ex.get_event_connection')
     # any connections left ?
     if len(self.event_conn_queue):
         return self.event_conn_queue.pop(0)
     # No available connections, can we create 
     # another one?
     if not self.event_connections < MAX_EVENT_CONNS:
         return None
     # create another one
     ep = EVENT_ENDPOINT.split(':')
     ep = (ep[0], int(ep[1]))
     self.event_connections += 1
     conn = Connection(
             ep, 
             self.loop, 
             self.create_win_request, 
             self.receive_win_response, 
             self.remove_event_connection,
             None)
     state = conn.connect()
     if state == Connection.STATE_CONNECTING:
        logging.debug('event connecting with id %d' % conn.id)
     self.event_conns[conn.id] = conn       
     return conn
Exemplo n.º 2
0
 def async_connect(self, endpoint):
     """
         Asynchronously connect to an endpoint
     """
     # create the connection
     logging.debug("launching async_connect to %s" % endpoint)
     ep = endpoint.split(":")
     ep = (ep[0], int(ep[1]))
     conn = Connection(ep, self.loop, self.create_request, self.receive_response, self.remove_connection, None)
     self.awaiting_conns[conn.id] = conn
     # create the entry
     if endpoint not in self.conns:
         self.conns[endpoint] = []
     state = conn.connect()
     if state == Connection.STATE_CONNECTING:
         logging.debug("connecting!")
Exemplo n.º 3
0
 def async_connect(self, endpoint):
     '''
         Asynchronously connect to an endpoint
     '''
     # create the connection
     logging.debug('launching async_connect to %s' % endpoint)
     ep = endpoint.split(':')
     ep = (ep[0], int(ep[1]))
     conn = Connection(ep, self.loop, self.create_request,
                       self.receive_response, self.remove_connection, None)
     self.awaiting_conns[conn.id] = conn
     # create the entry
     if endpoint not in self.conns:
         self.conns[endpoint] = []
     state = conn.connect()
     if state == Connection.STATE_CONNECTING:
         logging.debug('connecting!')