donate-cpu: try to handle socket error better when getting package

This commit is contained in:
Daniel Marjamäki 2018-11-14 21:41:16 +01:00
parent 5d086d60ad
commit d95d884bba
1 changed files with 6 additions and 2 deletions

View File

@ -96,8 +96,9 @@ def getPackage():
try:
sock.send(b'get\n')
package = sock.recv(256)
finally:
sock.close()
except socket.error:
package = ''
sock.close()
return package.decode('utf-8')
@ -298,6 +299,9 @@ while True:
print('Failed to compile Cppcheck, retry later')
sys.exit(1)
package = getPackage()
if len(package) == 0:
time.sleep(5)
package = getPackage()
tgz = downloadPackage(workpath, package)
unpackPackage(workpath, tgz)
crash = False