Mercurial > cosocket
changeset 59:b0f802c4fafc
Fixed what (I think) are channel memory management bugs.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Tue, 28 Apr 2009 22:07:52 -0700 |
parents | 7a2ecb3e800f |
children | aa0763886ec9 |
files | channels.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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()