206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 | |
def new(self, id=None): |
""" create a new Channel with 'id' (or create new id if None). """ |
self._writelock.acquire() |
try: |
if self.finished: |
raise IOError("connexion already closed: %s" % (self.gateway,)) |
if id is None: |
id = self.count |
self.count += 2 |
-> channel = Channel(self.gateway, id) |
self._channels[id] = channel |
return channel |
finally: |
self._writelock.release() | |