Improve threads in netrpc

bzr revid: ced-c0433cae35f57fe36fde662450cad35130324953
This commit is contained in:
ced 2007-08-13 07:50:01 +00:00
parent 2b9c12af43
commit c96337643d
1 changed files with 3 additions and 1 deletions

View File

@ -301,12 +301,14 @@ class TinySocketClientThread(threading.Thread):
ts = tiny_socket.mysocket(self.sock)
except:
self.sock.close()
self.threads.remove(self)
return False
while self.running:
try:
msg = ts.myreceive()
except:
self.sock.close()
self.threads.remove(self)
return False
try:
s=LocalService(msg[0])
@ -355,8 +357,8 @@ class TinySocketServerThread(threading.Thread):
while self.running:
(clientsocket, address) = self.socket.accept()
ct = TinySocketClientThread(clientsocket, self.threads)
ct.start()
self.threads.append(ct)
ct.start()
self.socket.close()
except Exception, e:
self.socket.close()