equal
deleted
inserted
replaced
111 |
111 |
112 import errno |
112 import errno |
113 import hashlib |
113 import hashlib |
114 import socket |
114 import socket |
115 import sys |
115 import sys |
116 import thread |
116 import threading |
117 |
117 |
118 from . import ( |
118 from . import ( |
119 util, |
119 util, |
120 ) |
120 ) |
121 |
121 |
133 """ |
133 """ |
134 The connection manager must be able to: |
134 The connection manager must be able to: |
135 * keep track of all existing |
135 * keep track of all existing |
136 """ |
136 """ |
137 def __init__(self): |
137 def __init__(self): |
138 self._lock = thread.allocate_lock() |
138 self._lock = threading.Lock() |
139 self._hostmap = {} # map hosts to a list of connections |
139 self._hostmap = {} # map hosts to a list of connections |
140 self._connmap = {} # map connections to host |
140 self._connmap = {} # map connections to host |
141 self._readymap = {} # map connection to ready state |
141 self._readymap = {} # map connection to ready state |
142 |
142 |
143 def add(self, host, connection, ready): |
143 def add(self, host, connection, ready): |