summaryrefslogtreecommitdiff
path: root/shared-module/network/__init__.c
diff options
context:
space:
mode:
Diffstat (limited to 'shared-module/network/__init__.c')
-rw-r--r--shared-module/network/__init__.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/shared-module/network/__init__.c b/shared-module/network/__init__.c
index c5783758d..bf33fef7a 100644
--- a/shared-module/network/__init__.c
+++ b/shared-module/network/__init__.c
@@ -43,6 +43,11 @@ void network_module_init(void) {
}
void network_module_deinit(void) {
+ for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) {
+ mp_obj_t nic = MP_STATE_PORT(mod_network_nic_list).items[i];
+ mod_network_nic_type_t *nic_type = (mod_network_nic_type_t*)mp_obj_get_type(nic);
+ if (nic_type->deinit != NULL) nic_type->deinit(nic);
+ }
mp_obj_list_set_len(&MP_STATE_PORT(mod_network_nic_list), 0);
}