gevent #287

Merged
Atheros1 merged 19 commits from master into master 2013-07-05 22:59:12 +02:00
Showing only changes of commit e2f9b01558 - Show all commits

View File

@ -66,7 +66,10 @@ class receiveDataThread(threading.Thread):
shared.printLock.release() shared.printLock.release()
while True: while True:
try: try:
dataLen = len(self.data)
self.data += self.sock.recv(4096) self.data += self.sock.recv(4096)
if len(self.data) == dataLen: # recv returns 0 bytes when the remote closes the connection
raise Exception("Remote closed the connection")
except socket.timeout: except socket.timeout:
shared.printLock.acquire() shared.printLock.acquire()
print 'Timeout occurred waiting for data from', self.HOST + '. Closing receiveData thread. (ID:', str(id(self)) + ')' print 'Timeout occurred waiting for data from', self.HOST + '. Closing receiveData thread. (ID:', str(id(self)) + ')'