diff options
author | David Rousselie <dax@happycoders.org> | 2008-08-21 23:17:34 +0400 |
---|---|---|
committer | David Rousselie <dax@happycoders.org> | 2008-08-21 23:17:34 +0400 |
commit | c7aa435502ec219f8c30e1fcefd525586d1b6d62 (patch) | |
tree | eaf7d36baa70744f2f694d003d3b1ef9177ba438 /src | |
parent | 48f562df6ca1c9700d3389ad47934347d3639505 (diff) |
make try-except-finally works with python 2.4
darcs-hash:20080821191734-86b55-88b99be3d4535aa935d28a4869d654401b9e0a23.gz
Diffstat (limited to 'src')
-rw-r--r-- | src/jcl/jabber/component.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/jcl/jabber/component.py b/src/jcl/jabber/component.py index adced1c..bcfaa46 100644 --- a/src/jcl/jabber/component.py +++ b/src/jcl/jabber/component.py @@ -674,15 +674,16 @@ class JCLComponent(Component, object): name="TimerThread") timer_thread.start() try: - while (self.running and self.stream - and not self.stream.eof - and self.stream.socket is not None): - self.stream.loop_iter(JCLComponent.timeout) - if self.queue.qsize(): - raise self.queue.get(0) - except socket.error, e: - self.__logger.info("Connection failed, restarting.") - return (True, 5) + try: + while (self.running and self.stream + and not self.stream.eof + and self.stream.socket is not None): + self.stream.loop_iter(JCLComponent.timeout) + if self.queue.qsize(): + raise self.queue.get(0) + except socket.error, e: + self.__logger.info("Connection failed, restarting.") + return (True, 5) finally: self.running = False timer_thread.join(JCLComponent.timeout) |