Commit 259d4544 authored by Vincent Pelletier's avatar Vincent Pelletier

Remove "try..except: pass ; else .." block.

This uncovered the bug fixed in r1553, and also uncovered a bug in
test_01_EpollEventManager (fixed in this commit).

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1650 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f1ff4ca1
...@@ -178,18 +178,14 @@ class EpollEventManager(object): ...@@ -178,18 +178,14 @@ class EpollEventManager(object):
if fd in r_done_set: if fd in r_done_set:
continue continue
r_done_set.add(fd) r_done_set.add(fd)
conn = self.connection_dict[fd]
conn.lock()
try: try:
conn = self.connection_dict[fd] conn.readable()
except KeyError: finally:
pass conn.unlock()
else: if conn.hasPendingMessages():
conn.lock() self._addPendingConnection(conn)
try:
conn.readable()
finally:
conn.unlock()
if conn.hasPendingMessages():
self._addPendingConnection(conn)
w_done_set = set() w_done_set = set()
for fd in wlist: for fd in wlist:
......
...@@ -114,7 +114,10 @@ class EventTests(NeoTestBase): ...@@ -114,7 +114,10 @@ class EventTests(NeoTestBase):
w_connector = Mock({"getDescriptor" : 351621}) w_connector = Mock({"getDescriptor" : 351621})
w_conn = Mock({'getConnector': w_connector}) w_conn = Mock({'getConnector': w_connector})
em.register(w_conn) em.register(w_conn)
em.epoll = Mock({"poll":((r_conn.getDescriptor(),),(w_conn.getDescriptor(),))}) em.epoll = Mock({"poll":(
(r_connector.getDescriptor(),),
(w_connector.getDescriptor(),),
)})
em.poll(timeout=10) em.poll(timeout=10)
# check it called poll on epoll # check it called poll on epoll
self.assertEquals(len(em.epoll.mockGetNamedCalls("poll")), 1) self.assertEquals(len(em.epoll.mockGetNamedCalls("poll")), 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment