Ejemplo 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
Ejemplo n.º 2
0
 def __init__(self, loop):
     self.loop = loop
     self.watchers = []
     ep = EVENT_ENDPOINT.split(':')
     self.endpoint = (ep[0], int(ep[1]))
     self.timers = []
     self.stats_timer = pyev.Timer(3.0, 3.0, self.loop, self.print_stats)
     self.stats_timer.start()
     self.reqs = 0
     self.resps = 0
     self.no_resps = 0
     self.errors = 0
     self.conn_pool = [
         EphemeralConnection(self.loop, self.endpoint, '', self.recv_http,
                             self.on_error, self.no_response)
         for i in range(900)
     ]
     self.conn_use = []
Ejemplo n.º 3
0
 def __init__(self, loop):
     self.loop = loop
     self.watchers = []
     ep = EVENT_ENDPOINT.split(':')
     self.endpoint = (ep[0], int(ep[1]))
     self.timers = []
     self.stats_timer = pyev.Timer(
                         3.0, 
                         3.0, 
                         self.loop,
                         self.print_stats)
     self.stats_timer.start()
     self.reqs = 0
     self.resps = 0
     self.no_resps = 0
     self.errors = 0
     self.conn_pool = [
         EphemeralConnection(
             self.loop, self.endpoint, '', self.recv_http,
             self.on_error, self.no_response) for i in range(900)
     ]
     self.conn_use = []