summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvery Pennarun <apenwarr@gmail.com>2010-12-11 17:27:12 -0800
committerAvery Pennarun <apenwarr@gmail.com>2010-12-11 17:27:12 -0800
commit41fd0348eb8f27d9c47d0b51c49fbf92d769ab5b (patch)
treeddcddbfd75f1ada616c83de219bf00056aa1a65e
parent1907048dad40c5cd6e8b13fe093b6cdf5598b9ff (diff)
Fix a bug when packets are received on a channel after it closes.sshuttle-0.43a
Reported by cbowns.
-rw-r--r--ssnet.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/ssnet.py b/ssnet.py
index 1577aa4..c06498f 100644
--- a/ssnet.py
+++ b/ssnet.py
@@ -350,8 +350,12 @@ class Mux(Handler):
else:
raise Exception('got CMD_HOST_LIST without got_host_list?')
else:
- callback = self.channels[channel]
- callback(cmd, data)
+ callback = self.channels.get(channel)
+ if not callback:
+ log('warning: closed channel %d got cmd=%s len=%d\n'
+ % (channel, cmd_to_name.get(cmd,hex(cmd)), len(data)))
+ else:
+ callback(cmd, data)
def flush(self):
self.wsock.setblocking(False)