summaryrefslogtreecommitdiffstatshomepage
path: root/esp8266
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-01 12:53:50 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-01 12:53:50 +0300
commit777232c9a5ce15ca7c7b0b3c52dd2a3b00bb1acc (patch)
treed5330f4b8cdddc93d27b65a7d67dc0d500913c05 /esp8266
parent3d4a5352086894414a291dac14fbfd6166cfae3e (diff)
downloadmicropython-777232c9a5ce15ca7c7b0b3c52dd2a3b00bb1acc.tar.gz
micropython-777232c9a5ce15ca7c7b0b3c52dd2a3b00bb1acc.zip
esp8266: Disallow recursive calls to REPL.
Before this change, if REPL blocked executing some code, it was possible to still input new statememts and excuting them, all leading to weird, and portentially dangerous interaction. TODO: Current implementation may have issues processing input accumulated while REPL was blocked.
Diffstat (limited to 'esp8266')
-rw-r--r--esp8266/uart.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/esp8266/uart.c b/esp8266/uart.c
index c4d08eac4b..9b2bfb4c83 100644
--- a/esp8266/uart.c
+++ b/esp8266/uart.c
@@ -234,6 +234,17 @@ void mp_keyboard_interrupt(void);
int interrupt_char;
void uart_task_handler(os_event_t *evt) {
+ if (pyexec_repl_active) {
+ // TODO: Just returning here isn't exactly right.
+ // What really should be done is something like
+ // enquing delayed event to itself, for another
+ // chance to feed data to REPL. Otherwise, there
+ // can be situation when buffer has bunch of data,
+ // and sits unprocessed, because we consumed all
+ // processing signals like this.
+ return;
+ }
+
int c, ret = 0;
while ((c = ringbuf_get(&input_buf)) >= 0) {
if (c == interrupt_char) {