Skip to content

fix OTA #5454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2018
Merged

fix OTA #5454

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions tools/espota.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
sock.close()
return 1

received_ok = False

try:
f = open(filename, "rb")
if (PROGRESS):
Expand All @@ -160,7 +162,9 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
connection.settimeout(10)
try:
connection.sendall(chunk)
res = connection.recv(4)
if connection.recv(32).decode().find('O') >= 0:
# connection will receive only digits or 'OK'
received_ok = True;
except:
sys.stderr.write('\n')
logging.error('Error Uploading')
Expand All @@ -176,8 +180,10 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
# the connection before receiving the 'O' of 'OK'
try:
connection.settimeout(60)
while True:
if connection.recv(32).decode().find('O') >= 0: break
while not received_ok:
if connection.recv(32).decode().find('O') >= 0:
# connection will receive only digits or 'OK'
received_ok = True;
logging.info('Result: OK')
connection.close()
f.close()
Expand Down