handle signal soon; #179

This commit is contained in:
clowwindy 2014-09-12 22:18:08 +08:00
parent e43520da58
commit 380a646f09
3 changed files with 16 additions and 15 deletions

View file

@ -206,9 +206,10 @@ class EventLoop(object):
events = self.poll(1)
except (OSError, IOError) as e:
if errno_from_exception(e) in (errno.EPIPE, errno.EINTR):
# Happens when the client closes the connection
# EPIPE: Happens when the client closes the connection
# EINTR: Happens when received a signal
# handles them as soon as possible
logging.debug('poll:%s', e)
continue
else:
logging.error('poll:%s', e)
import traceback