Skip to content

Commit a8b7b35

Browse files
author
Paul Sokolovsky
committed
webrepl.html: Update "get file" protocol.
"Get" protocol now requires receiving a lead byte from client before transferring each new packet with file contents. This makes it naturally non-blocking (while webrepl waits to receive this byte, MicroPython can execute other tasks).
1 parent 6a8e14a commit a8b7b35

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

webrepl.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@
181181
// first response for get
182182
if (decode_resp(data) == 0) {
183183
binary_state = 22;
184+
var rec = new Uint8Array(1);
185+
rec[0] = 0;
186+
ws.send(rec);
184187
}
185188
break;
186189
case 22: {
@@ -198,6 +201,10 @@
198201
new_buf.set(data.slice(2), get_file_data.length);
199202
get_file_data = new_buf;
200203
update_file_status('Getting ' + get_file_name + ', ' + get_file_data.length + ' bytes');
204+
205+
var rec = new Uint8Array(1);
206+
rec[0] = 0;
207+
ws.send(rec);
201208
}
202209
} else {
203210
binary_state = 0;

0 commit comments

Comments
 (0)