diff options
| author | Daniël van de Giessen <daniel@dvdgiessen.nl> | 2025-08-12 13:09:24 +0200 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-08-25 23:11:33 +1000 |
| commit | 1df5ee12e880fcd5a5129c7f0c077abdf2387f5a (patch) | |
| tree | 043c743732e330971050bf7e48f36d408055e363 /extmod | |
| parent | 72147c02c7e630505515746e0ac6ac31f34c143b (diff) | |
esp32/network_ppp: Stop polling if PPP was disconnected.
When disconnecting from PPP the modem sends a confirmation. This message
is received, like all messages, through the poll() method. lwIP may then
immediately call our status callback with code PPPERR_USER to indicate
the connection was closed. Our callback then immediately proceeds to
free the PCB. Thus, during each new iteration of the loop in poll() we
must check if we haven't disconnected in the meantime to prevent calling
the pppos_input_tcpip with a PCB that is now NULL.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Diffstat (limited to 'extmod')
| -rw-r--r-- | extmod/network_ppp_lwip.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/network_ppp_lwip.c b/extmod/network_ppp_lwip.c index 15e3ba029..d7a1cf5e0 100644 --- a/extmod/network_ppp_lwip.c +++ b/extmod/network_ppp_lwip.c @@ -146,7 +146,7 @@ static mp_obj_t network_ppp_poll(size_t n_args, const mp_obj_t *args) { mp_int_t total_len = 0; mp_obj_t stream; - while ((stream = self->stream) != mp_const_none) { + while (self->state >= STATE_ACTIVE && (stream = self->stream) != mp_const_none) { uint8_t buf[256]; int err; mp_uint_t len = mp_stream_rw(stream, buf, sizeof(buf), &err, 0); |
