Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bdc45e3

Browse filesBrowse files
Gei0rme-no-dev
authored andcommitted
[OTA] Fix "Error response from device" if OK response comes to early (espressif#1695)
Because TCP is stream-based, an earlier read can 'take away' the "OK" response from the device, so that a later read doesn't get the message.
1 parent a7ddf39 commit bdc45e3
Copy full SHA for bdc45e3

File tree

1 file changed

+8
-0
lines changed
Filter options

1 file changed

+8
-0
lines changed

‎tools/espota.py

Copy file name to clipboardExpand all lines: tools/espota.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
179179
try:
180180
connection.sendall(chunk)
181181
res = connection.recv(10)
182+
lastResponseContainedOK = 'OK' in res.decode()
182183
except:
183184
sys.stderr.write('\n')
184185
logging.error('Error Uploading')
@@ -187,6 +188,13 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
187188
sock.close()
188189
return 1
189190

191+
if lastResponseContainedOK:
192+
logging.info('Success')
193+
connection.close()
194+
f.close()
195+
sock.close()
196+
return 0
197+
190198
sys.stderr.write('\n')
191199
logging.info('Waiting for result...')
192200
try:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.