Commit 89596c87 authored by ibuler's avatar ibuler

[Update] 捕捉异常

parent 778493ed
...@@ -125,7 +125,7 @@ class Client(object): ...@@ -125,7 +125,7 @@ class Client(object):
def send(self, b): def send(self, b):
try: try:
return self.chan.send(b) return self.chan.send(b)
except EOFError: except (EOFError, OSError):
return 0 return 0
def send_unicode(self, s): def send_unicode(self, s):
......
...@@ -166,10 +166,12 @@ class Session: ...@@ -166,10 +166,12 @@ class Session:
self.sel.register(self.server, selectors.EVENT_READ) self.sel.register(self.server, selectors.EVENT_READ)
self.sel.register(self.stop_evt, selectors.EVENT_READ) self.sel.register(self.stop_evt, selectors.EVENT_READ)
self.sel.register(self.client.change_size_evt, selectors.EVENT_READ) self.sel.register(self.client.change_size_evt, selectors.EVENT_READ)
if self.client.closed:
return
while not self.is_finished: while not self.is_finished:
events = self.sel.select(timeout=60) events = self.sel.select(timeout=60)
if self.client.closed:
break
if self.server.closed:
break
for sock in [key.fileobj for key, _ in events]: for sock in [key.fileobj for key, _ in events]:
data = sock.recv(BUF_SIZE) data = sock.recv(BUF_SIZE)
if sock == self.server: if sock == self.server:
......
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