make try-except-finally works with python 2.4

darcs-hash:20080821191734-86b55-88b99be3d4535aa935d28a4869d654401b9e0a23.gz
This commit is contained in:
David Rousselie
2008-08-21 21:17:34 +02:00
parent 48f562df6c
commit c7aa435502

View File

@@ -674,15 +674,16 @@ class JCLComponent(Component, object):
name="TimerThread") name="TimerThread")
timer_thread.start() timer_thread.start()
try: try:
while (self.running and self.stream try:
and not self.stream.eof while (self.running and self.stream
and self.stream.socket is not None): and not self.stream.eof
self.stream.loop_iter(JCLComponent.timeout) and self.stream.socket is not None):
if self.queue.qsize(): self.stream.loop_iter(JCLComponent.timeout)
raise self.queue.get(0) if self.queue.qsize():
except socket.error, e: raise self.queue.get(0)
self.__logger.info("Connection failed, restarting.") except socket.error, e:
return (True, 5) self.__logger.info("Connection failed, restarting.")
return (True, 5)
finally: finally:
self.running = False self.running = False
timer_thread.join(JCLComponent.timeout) timer_thread.join(JCLComponent.timeout)