Skip to content

Commit e8f09c2

Browse files
author
Jonathan Warren
committed
Merge pull request #277 from pgimeno/cpu100percentfix
Fix issue #183 (CPU 100% usage)
2 parents bfdb047 + 95a1afb commit e8f09c2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/class_receiveDataThread.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ def run(self):
6666
shared.printLock.release()
6767
while True:
6868
try:
69+
dataLen = len(self.data)
6970
self.data += self.sock.recv(4096)
71+
if len(self.data) == dataLen: # recv returns 0 bytes when the remote closes the connection
72+
raise Exception("Remote closed the connection")
7073
except socket.timeout:
7174
shared.printLock.acquire()
7275
print 'Timeout occurred waiting for data from', self.HOST + '. Closing receiveData thread. (ID:', str(id(self)) + ')'

0 commit comments

Comments
 (0)