~me-smira/txamqp/patches

« back to all changes in this revision

Viewing changes to src/txamqp/protocol.py

  • Committer: Andrey Smirnov
  • Date: 2010-02-17 05:59:47 UTC
  • Revision ID: smira@andrey-smirnovs-macbook-pro.local-20100217055947-sh6oxdf6vhhywca2
Add service functions to close channel/queue on request.

For example, when channel was closed on server due to errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
284
284
            self.queueLock.release()
285
285
        defer.returnValue(q)
286
286
 
 
287
    @defer.inlineCallbacks
 
288
    def closeChannel(self, channel):
 
289
        yield self.channelLock.acquire()
 
290
        try:
 
291
            channel.close(None)
 
292
            del self.channels[channel.id]
 
293
        finally:
 
294
            self.channelLock.release()
 
295
 
 
296
    @defer.inlineCallbacks
 
297
    def closeQueue(self, key, queue):
 
298
         yield self.queueLock.acquire()
 
299
         try:
 
300
            queue.close()
 
301
            del self.queues[key]
 
302
         finally:
 
303
            self.queueLock.release()
 
304
 
287
305
    def close(self, reason):
288
306
        for ch in self.channels.values():
289
307
            ch.close(reason)