Skip to content

Commit

Permalink
Detect error conditions after reading from sockets
Browse files Browse the repository at this point in the history
This change is in the hypercoordinator main loop.
  • Loading branch information
rescrv committed May 18, 2012
1 parent cf8fe7a commit 5041891
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions hypercoordinator/coordinator.py
Expand Up @@ -758,18 +758,18 @@ def run(self):
sock, conn = self._conns[fd]
remove = False
try:
if ev & select.POLLIN:
conn.handle_in()
if ev & select.POLLOUT:
conn.handle_out()
if conn.outgoing == '':
self._p.modify(fd, select.POLLIN)
if ev & select.POLLERR:
remove = True
elif ev & select.POLLHUP:
remove = True
elif ev & select.POLLNVAL:
remove = True
if not remove and ev & select.POLLIN:
conn.handle_in()
if not remove and ev & select.POLLOUT:
conn.handle_out()
if conn.outgoing == '':
self._p.modify(fd, select.POLLIN)
except KillConnection as kc:
logging.error('connection killed: ' + str(kc))
remove = True
Expand Down

0 comments on commit 5041891

Please sign in to comment.