Skip to content
Browse files

Fix a bug when packets are received on a channel after it closes.

Reported by cbowns.
  • Loading branch information...
1 parent 1907048 commit 41fd0348eb8f27d9c47d0b51c49fbf92d769ab5b @apenwarr apenwarr committed Dec 11, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 ssnet.py
View
8 ssnet.py
@@ -350,8 +350,12 @@ def got_packet(self, channel, cmd, data):
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)

0 comments on commit 41fd034

Please sign in to comment.
Something went wrong with that request. Please try again.