summaryrefslogtreecommitdiff
path: root/extmod/modwebrepl.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-29 19:14:03 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-29 19:14:03 +0300
commitb0f3ae58e72519f8c520184a36288a797c6d11b0 (patch)
tree387383d52f3b983959b01e2ce696b34f529c9f88 /extmod/modwebrepl.c
parent8811b0af9c73baf37caa2e7bf4842f4518447026 (diff)
extmod/modwebrepl: Add rate-limiting workaround for broken network drivers.
Like ESP8266 has.
Diffstat (limited to 'extmod/modwebrepl.c')
-rw-r--r--extmod/modwebrepl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/extmod/modwebrepl.c b/extmod/modwebrepl.c
index 57792796c..a76016e63 100644
--- a/extmod/modwebrepl.c
+++ b/extmod/modwebrepl.c
@@ -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;