Commit 7e2dc318 authored by Jason Madden's avatar Jason Madden

One more place to account for the socket.error switchero on Python3. Still...

One more place to account for the socket.error switchero on Python3. Still doesn't fix nagios/ruok though.
parent 2517e0ec
...@@ -167,7 +167,10 @@ class SizedMessageAsyncConnection(asyncore.dispatcher): ...@@ -167,7 +167,10 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
try: try:
d = self.recv(8192) d = self.recv(8192)
except socket.error as err: except socket.error as err:
if err[0] in expected_socket_read_errors: # Python >= 3.3 makes select.error an alias of OSError,
# which is not subscriptable but does have the 'errno' attribute
err_errno = getattr(err, 'errno', None) or err[0]
if err_errno in expected_socket_read_errors:
return return
raise raise
if not d: if not d:
...@@ -291,7 +294,10 @@ class SizedMessageAsyncConnection(asyncore.dispatcher): ...@@ -291,7 +294,10 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
# Fix for https://bugs.launchpad.net/zodb/+bug/182833 # Fix for https://bugs.launchpad.net/zodb/+bug/182833
# ensure the above mentioned "output" invariant # ensure the above mentioned "output" invariant
output.insert(0, v) output.insert(0, v)
if err[0] in expected_socket_write_errors: # Python >= 3.3 makes select.error an alias of OSError,
# which is not subscriptable but does have the 'errno' attribute
err_errno = getattr(err, 'errno', None) or err[0]
if err_errno in expected_socket_write_errors:
break # we couldn't write anything break # we couldn't write anything
raise raise
......
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