# HG changeset patch # User Atul Varma # Date 1240981672 25200 # Node ID b0f802c4fafc6230dd8b804728c2221c2c87d251 # Parent 7a2ecb3e800f77686d3c0487e0df941bf42d359b Fixed what (I think) are channel memory management bugs. diff -r 7a2ecb3e800f -r b0f802c4fafc channels.py --- a/channels.py Tue Apr 28 21:37:00 2009 -0700 +++ b/channels.py Tue Apr 28 22:07:52 2009 -0700 @@ -26,16 +26,17 @@ self._fd = dispatcher.socket.fileno() _channels[self.channel_name][self._fd] = dispatcher - def abort(self): + def finalize(self): if (self.channel_name in _channels and self._fd in _channels[self.channel_name]): del _channels[self.channel_name][self._fd] + if not _channels[self.channel_name]: + del _channels[self.channel_name] def until_message_received(channel_name): instruction = _until_message_received(channel_name) try: message = yield instruction yield cosocket.return_value(message) - except GeneratorExit: - instruction.abort() - raise + finally: + instruction.finalize()