Donate CPU: Make server more robust

This commit is contained in:
Daniel Marjamäki 2018-08-25 20:00:04 +02:00
parent 7049249460
commit 5da38e33c0
1 changed files with 4 additions and 1 deletions

View File

@ -142,7 +142,10 @@ if __name__ == "__main__":
# wait for a connection
print('[' + strDateTime() + '] waiting for a connection')
connection, client_address = sock.accept()
try:
cmd = connection.recv(128)
except socket.error as e:
continue
if cmd.find('\n') < 1:
continue
firstLine = cmd[:cmd.find('\n')]