summaryrefslogtreecommitdiff
path: root/extmod/network_lwip.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-07-07 12:32:29 +1000
committerDamien George <damien@micropython.org>2025-07-17 13:38:58 +1000
commitcf490ed34618782cef591a41438a62e1437d7d5c (patch)
tree2065fe0fe7854d18c5f71a5e5ff91035482ebc9c /extmod/network_lwip.c
parent8504391766cf9cd181ea178669b75e362043694d (diff)
extmod/network_lwip: Add sys_untimeout_all_with_arg helper function.
Really lwIP should provide this, to deregister all callbacks on the given netif. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/network_lwip.c')
-rw-r--r--extmod/network_lwip.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/extmod/network_lwip.c b/extmod/network_lwip.c
index 71dc295e1..9cfab6ef4 100644
--- a/extmod/network_lwip.c
+++ b/extmod/network_lwip.c
@@ -52,6 +52,19 @@ int mp_mod_network_prefer_dns_use_ip_version = 4;
// Implementations of network methods that can be used by any interface.
+// This follows sys_untimeout but removes all timeouts with the given argument.
+void sys_untimeout_all_with_arg(void *arg) {
+ for (struct sys_timeo **t = sys_timeouts_get_next_timeout(); *t != NULL;) {
+ if ((*t)->arg == arg) {
+ struct sys_timeo *next = (*t)->next;
+ memp_free(MEMP_SYS_TIMEOUT, *t);
+ *t = next;
+ } else {
+ t = &(*t)->next;
+ }
+ }
+}
+
// This function provides the implementation of nic.ifconfig, is deprecated and will be removed.
// Use network.ipconfig and nic.ipconfig instead.
mp_obj_t mod_network_nic_ifconfig(struct netif *netif, size_t n_args, const mp_obj_t *args) {