Fixed IOStream._handle_events (try/except block)

Fixed IOStream._handle_events (try/except block) to prevent
infinite loop when an unhandled exception occurs
This commit is contained in:
Imre SZEBENYI 2010-10-27 13:34:47 +02:00
parent af3d0b3b03
commit 3b486fc4f8
1 changed files with 26 additions and 20 deletions

View File

@ -189,6 +189,7 @@ class IOStream(object):
if not self.socket:
logging.warning("Got events for closed stream %d", fd)
return
try:
if events & self.io_loop.READ:
self._handle_read()
if not self.socket:
@ -210,6 +211,11 @@ class IOStream(object):
if state != self._state:
self._state = state
self.io_loop.update_handler(self.socket.fileno(), self._state)
except:
logging.error("Uncaught exception, closing connection.",
exc_info=True)
self.close()
raise
def _run_callback(self, callback, *args, **kwargs):
try: