Permalink
Browse files

Detect error conditions after reading from sockets

This change is in the hypercoordinator main loop.
  • Loading branch information...
1 parent cf8fe7a commit 504189104b6c4e4a98c689e41a45c159279b8030 @rescrv committed May 18, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 hypercoordinator/coordinator.py
@@ -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

0 comments on commit 5041891

Please sign in to comment.