esp32/network_ppp: Stop polling if stream becomes None.

If while a polling operation is active the stream is removed we should
stop polling data from that stream.

This was already the intended behaviour, but implemented incorrectly.

Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
This commit is contained in:
Daniël van de Giessen 2025-08-12 13:09:24 +02:00 committed by Damien George
parent 053aade741
commit 72147c02c7
2 changed files with 4 additions and 4 deletions

View file

@ -145,8 +145,8 @@ 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 = self->stream;
while (stream != mp_const_none) {
mp_obj_t stream;
while ((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);

View file

@ -153,8 +153,8 @@ 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 = self->stream;
while (stream != mp_const_none) {
mp_obj_t stream;
while ((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);