Commit 38bb7f3c authored by Avery Pennarun's avatar Avery Pennarun

If we get EPIPE on uwrite(), don't close, just do nowrite().

EPIPE doesn't mean the whole socket is dead, it just means we can't write to
it.  Maybe there's still data waiting to be read, though.
parent b7f1530a
...@@ -163,6 +163,11 @@ class SockWrapper: ...@@ -163,6 +163,11 @@ class SockWrapper:
try: try:
return _nb_clean(os.write, self.wsock.fileno(), buf) return _nb_clean(os.write, self.wsock.fileno(), buf)
except OSError, e: except OSError, e:
if e.errno == errno.EPIPE:
debug1('%r: uwrite: got EPIPE\n' % self)
self.nowrite()
return 0
else:
# unexpected error... stream is dead # unexpected error... stream is dead
self.seterr('uwrite: %s' % e) self.seterr('uwrite: %s' % e)
return 0 return 0
......
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