Skip to content

Commit

Permalink
extmod/network_ppp_lwip: Tweak finaliser.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed May 17, 2024
1 parent 2724273 commit 5e3dff1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions extmod/network_ppp_lwip.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,13 @@ static mp_obj_t network_ppp_make_new(const mp_obj_type_t *type, size_t n_args, s

static mp_obj_t network_ppp___del__(mp_obj_t self_in) {
network_ppp_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->state >= STATE_ERROR) {
// Still connnected over the UART stream.
// Force the connection to close, with nocarrier=1.
self->state = STATE_ACTIVE;
ppp_close(self->pcb, 1);
} else if (self->state == STATE_ACTIVE) {
if (self->state >= STATE_ACTIVE) {
if (self->state >= STATE_ERROR) {
// Still connnected over the UART stream.
// Force the connection to close, with nocarrier=1.
self->state = STATE_INACTIVE;
ppp_close(self->pcb, 1);
}
// Free PPP PCB and reset state.
self->state = STATE_INACTIVE;
ppp_free(self->pcb);
Expand Down

0 comments on commit 5e3dff1

Please sign in to comment.