mirror of
https://github.com/sshuttle/sshuttle.git
synced 2024-11-22 07:53:43 +01:00
ssnet: recover slightly more gracefully from an infinite forwarding loop.
If you 'telnet localhost 12300' weird things happen; someday we should probably auto-detect and avoid that altogether. But meanwhile, catch EPIPE if it happens (it's irrelevant) and don't barf with a %d data type for a value that can apparently sometimes be None.
This commit is contained in:
parent
410b9d4229
commit
4bf4f70c67
4
ssnet.py
4
ssnet.py
@ -35,7 +35,7 @@ def _nb_clean(func, *args):
|
||||
try:
|
||||
return func(*args)
|
||||
except OSError, e:
|
||||
if e.errno not in (errno.EWOULDBLOCK, errno.EAGAIN):
|
||||
if e.errno not in (errno.EWOULDBLOCK, errno.EAGAIN, errno.EPIPE):
|
||||
raise
|
||||
else:
|
||||
return None
|
||||
@ -308,7 +308,7 @@ class Mux(Handler):
|
||||
self.wsock.setblocking(False)
|
||||
if self.outbuf and self.outbuf[0]:
|
||||
wrote = _nb_clean(os.write, self.wsock.fileno(), self.outbuf[0])
|
||||
debug2('mux wrote: %d/%d\n' % (wrote, len(self.outbuf[0])))
|
||||
debug2('mux wrote: %r/%d\n' % (wrote, len(self.outbuf[0])))
|
||||
if wrote:
|
||||
self.outbuf[0] = self.outbuf[0][wrote:]
|
||||
while self.outbuf and not self.outbuf[0]:
|
||||
|
Loading…
Reference in New Issue
Block a user