Skip to content
Snippets Groups Projects
Commit 19e3c9d5 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

esp8266/esp_mphal: Don't swallow exceptions in dupterm's read()/write().

The idea is that if dupterm object can handle exceptions, it will handle
them itself. Otherwise, object state can be compromised and it's better
to terminate dupterm session. For example, disconnected socket will keep
throwing exceptions and dump messages about that.
parent 54ea253f
Branches
No related tags found
No related merge requests found
...@@ -185,12 +185,9 @@ static int call_dupterm_read(void) { ...@@ -185,12 +185,9 @@ static int call_dupterm_read(void) {
nlr_pop(); nlr_pop();
return *(byte*)bufinfo.buf; return *(byte*)bufinfo.buf;
} else { } else {
// Temporarily disable dupterm to avoid infinite recursion
mp_obj_t save_term = MP_STATE_PORT(term_obj);
MP_STATE_PORT(term_obj) = NULL; MP_STATE_PORT(term_obj) = NULL;
mp_printf(&mp_plat_print, "dupterm: "); mp_printf(&mp_plat_print, "dupterm: Exception in read() method, deactivating: ");
mp_obj_print_exception(&mp_plat_print, nlr.ret_val); mp_obj_print_exception(&mp_plat_print, nlr.ret_val);
MP_STATE_PORT(term_obj) = save_term;
} }
return -1; return -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment