Skip to content

Commit 4478fe8

Browse files
authoredMar 22, 2025
Fix failure to close listening socket (#3679)
The IDF LWIP's `netconn_close()` no longer returns valid error codes as the #ifdef'd code path the IDF uses does not end up actually doing much, which unfortunately includes actually setting the error code. As such, checking the return code is actively harmful to proper operation for us. The fix here is simply to carry on with the `netconn_delete()`. This _should_ be safe even if `netconn_close()` actually errored.
1 parent d53f8fe commit 4478fe8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎components/modules/net.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,11 @@ void handle_dns_event(task_param_t param, task_prio_t prio)
351351

352352

353353
static err_t netconn_close_and_delete(struct netconn *conn) {
354-
err_t err = netconn_close(conn);
355-
if (err == ERR_OK)
356-
netconn_delete(conn);
357-
358-
return err;
354+
// netconn_close() no longer returns valid return codes, as the code
355+
// path we get in the IDF ends up using uninitialised memory.
356+
netconn_close(conn);
357+
netconn_delete(conn);
358+
return ERR_OK;
359359
}
360360

361361

0 commit comments

Comments
 (0)
Failed to load comments.