summaryrefslogtreecommitdiff
path: root/extmod/modlwip.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/modlwip.c')
-rw-r--r--extmod/modlwip.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index 00fd10964..8811742d6 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -1502,16 +1502,16 @@ STATIC mp_uint_t lwip_socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
return 0;
}
- // Deregister callback (pcb.tcp is set to NULL below so must deregister now)
- tcp_arg(socket->pcb.tcp, NULL);
- tcp_err(socket->pcb.tcp, NULL);
- tcp_recv(socket->pcb.tcp, NULL);
-
// Free any incoming buffers or connections that are stored
lwip_socket_free_incoming(socket);
switch (socket->type) {
case MOD_NETWORK_SOCK_STREAM: {
+ // Deregister callback (pcb.tcp is set to NULL below so must deregister now)
+ tcp_arg(socket->pcb.tcp, NULL);
+ tcp_err(socket->pcb.tcp, NULL);
+ tcp_recv(socket->pcb.tcp, NULL);
+
if (socket->pcb.tcp->state != LISTEN) {
// Schedule a callback to abort the connection if it's not cleanly closed after
// the given timeout. The callback must be set before calling tcp_close since
@@ -1525,10 +1525,12 @@ STATIC mp_uint_t lwip_socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
break;
}
case MOD_NETWORK_SOCK_DGRAM:
+ udp_recv(socket->pcb.udp, NULL, NULL);
udp_remove(socket->pcb.udp);
break;
#if MICROPY_PY_LWIP_SOCK_RAW
case MOD_NETWORK_SOCK_RAW:
+ raw_recv(socket->pcb.raw, NULL, NULL);
raw_remove(socket->pcb.raw);
break;
#endif