Commit b0f3ae58 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

extmod/modwebrepl: Add rate-limiting workaround for broken network drivers.

Like ESP8266 has.
parent 8811b0af
......@@ -34,6 +34,9 @@
#include "py/runtime.h"
#include "py/stream.h"
#include "py/builtin.h"
#ifdef MICROPY_PY_WEBREPL_DELAY
#include "py/mphal.h"
#endif
#include "extmod/modwebsocket.h"
#if MICROPY_PY_WEBREPL
......@@ -221,6 +224,14 @@ STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
DEBUG_printf("webrepl: Finished writing file\n");
write_webrepl_resp(self->sock, 0);
}
#ifdef MICROPY_PY_WEBREPL_DELAY
// Some platforms may have broken drivers and easily gets
// overloaded with modest traffic WebREPL file transfers
// generate. The basic workaround is a crude rate control
// done in such way.
mp_hal_delay_ms(MICROPY_PY_WEBREPL_DELAY);
#endif
}
return -2;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment