|
|
@ -455,20 +455,20 @@ def io_op(func, *args):
|
|
|
|
signalled by :data:`errno.EPIPE`.
|
|
|
|
signalled by :data:`errno.EPIPE`.
|
|
|
|
|
|
|
|
|
|
|
|
:returns:
|
|
|
|
:returns:
|
|
|
|
Tuple of `(return_value, disconnected)`, where `return_value` is the
|
|
|
|
Tuple of `(return_value, disconnect_reason)`, where `return_value` is
|
|
|
|
return value of `func(*args)`, and `disconnected` is :data:`True` if
|
|
|
|
the return value of `func(*args)`, and `disconnected` is an exception
|
|
|
|
disconnection was detected, otherwise :data:`False`.
|
|
|
|
instance when disconnection was detected, otherwise :data:`None`.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
return func(*args), False
|
|
|
|
return func(*args), None
|
|
|
|
except (select.error, OSError, IOError):
|
|
|
|
except (select.error, OSError, IOError):
|
|
|
|
e = sys.exc_info()[1]
|
|
|
|
e = sys.exc_info()[1]
|
|
|
|
_vv and IOLOG.debug('io_op(%r) -> OSError: %s', func, e)
|
|
|
|
_vv and IOLOG.debug('io_op(%r) -> OSError: %s', func, e)
|
|
|
|
if e.args[0] == errno.EINTR:
|
|
|
|
if e.args[0] == errno.EINTR:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
if e.args[0] in (errno.EIO, errno.ECONNRESET, errno.EPIPE):
|
|
|
|
if e.args[0] in (errno.EIO, errno.ECONNRESET, errno.EPIPE):
|
|
|
|
return None, True
|
|
|
|
return None, e
|
|
|
|
raise
|
|
|
|
raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|