Skip to content

Commit 6ff42aa

Browse files
committed
fix(net_connect): remove unused utilities and improve resource cleanup
- Remove protocol_examples_utils and addr_from_stdin files - Add null checks in ethernet shutdown to prevent crashes - Add proper cleanup in wifi shutdown and error paths - Update CMakeLists to reflect removed source files
1 parent 5211944 commit 6ff42aa

File tree

7 files changed

+18
-568
lines changed

7 files changed

+18
-568
lines changed

components/net_connect/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ idf_build_get_property(target IDF_TARGET)
33
if(${target} STREQUAL "linux")
44
# Header only library for linux
55

6-
idf_component_register(INCLUDE_DIRS include
7-
SRCS protocol_examples_utils.c)
6+
idf_component_register(INCLUDE_DIRS include)
87
return()
98
endif()
109

1110
set(srcs "stdin_out.c"
1211
"addr_from_stdin.c"
1312
"connect.c"
14-
"wifi_connect.c"
15-
"protocol_examples_utils.c")
13+
"wifi_connect.c")
1614

1715
if(CONFIG_NET_CONNECT_PROVIDE_WIFI_CONSOLE_CMD)
1816
list(APPEND srcs "console_cmd.c")

components/net_connect/addr_from_stdin.c

Lines changed: 0 additions & 83 deletions
This file was deleted.

components/net_connect/eth_connect.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,21 @@ static void eth_stop(void)
128128
/* tear down connection, release resources */
129129
void net_connect_ethernet_shutdown(void)
130130
{
131-
if (s_semph_get_ip_addrs == NULL) {
132-
return;
131+
#if CONFIG_NET_CONNECT_IPV4
132+
if (s_semph_get_ip_addrs != NULL) {
133+
vSemaphoreDelete(s_semph_get_ip_addrs);
134+
s_semph_get_ip_addrs = NULL;
133135
}
134-
vSemaphoreDelete(s_semph_get_ip_addrs);
135-
s_semph_get_ip_addrs = NULL;
136+
#endif
136137
#if CONFIG_NET_CONNECT_IPV6
137-
vSemaphoreDelete(s_semph_get_ip6_addrs);
138-
s_semph_get_ip6_addrs = NULL;
138+
if (s_semph_get_ip6_addrs != NULL) {
139+
vSemaphoreDelete(s_semph_get_ip6_addrs);
140+
s_semph_get_ip6_addrs = NULL;
141+
}
139142
#endif
140-
eth_stop();
143+
if (s_eth_netif != NULL) {
144+
eth_stop();
145+
}
141146
}
142147

143148
esp_err_t net_connect_ethernet_connect(void)

components/net_connect/include/addr_from_stdin.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

components/net_connect/include/protocol_examples_utils.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)