mirror of
https://github.com/micropython/micropython.git
synced 2025-07-21 04:51:12 +02:00
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>
This commit is contained in:
@@ -28,6 +28,9 @@
|
|||||||
|
|
||||||
#include "py/mpconfig.h"
|
#include "py/mpconfig.h"
|
||||||
|
|
||||||
|
// This is needed to access `next_timeout` via `sys_timeouts_get_next_timeout()`.
|
||||||
|
#define LWIP_TESTMODE 1
|
||||||
|
|
||||||
// This sys-arch protection is not needed.
|
// This sys-arch protection is not needed.
|
||||||
// Ports either protect lwIP code with flags, or run it at PendSV priority.
|
// Ports either protect lwIP code with flags, or run it at PendSV priority.
|
||||||
#define SYS_ARCH_DECL_PROTECT(lev) do { } while (0)
|
#define SYS_ARCH_DECL_PROTECT(lev) do { } while (0)
|
||||||
|
@@ -82,6 +82,9 @@ extern const struct _mp_obj_type_t mp_network_ppp_lwip_type;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct netif;
|
struct netif;
|
||||||
|
|
||||||
|
void sys_untimeout_all_with_arg(void *arg);
|
||||||
|
|
||||||
void mod_network_lwip_init(void);
|
void mod_network_lwip_init(void);
|
||||||
void mod_network_lwip_poll_wrapper(uint32_t ticks_ms);
|
void mod_network_lwip_poll_wrapper(uint32_t ticks_ms);
|
||||||
mp_obj_t mod_network_nic_ifconfig(struct netif *netif, size_t n_args, const mp_obj_t *args);
|
mp_obj_t mod_network_nic_ifconfig(struct netif *netif, size_t n_args, const mp_obj_t *args);
|
||||||
|
@@ -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.
|
// 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.
|
// This function provides the implementation of nic.ifconfig, is deprecated and will be removed.
|
||||||
// Use network.ipconfig and nic.ipconfig instead.
|
// 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) {
|
mp_obj_t mod_network_nic_ifconfig(struct netif *netif, size_t n_args, const mp_obj_t *args) {
|
||||||
|
Reference in New Issue
Block a user