|
From: | Bram Peeters |
Subject: | Re: [lwip-users] netconn_prepare_delete called twice when doing lwip_close leading to errno = EBADF |
Date: | Mon, 15 Mar 2021 16:18:53 +0000 |
Hi And a small related sideremark: At the end of lwip_close there is a
set_errno(0); I don’t know if that was put there to deal with the situation described below, but it does not do the job given the default implementation of set_errno in sockets_priv.h #ifndef set_errno Regards Bram From: lwip-users <lwip-users-bounces+bram.peeters=dekimo.com@nongnu.org>
On Behalf Of Bram Peeters Hi, When doing lwip close I get errno being set to EBADF. This happens with the following callstack: get_socket( “set_errno(EBADF);”
) event_callback() (“sock = get_socket(s);”) lwip_netconn_do_delconn (“API_EVENT(msg->conn,
NETCONN_EVT_RCVPLUS, 0)”)
<...> Upon investigation I think this is because in the lwip_close scenario netconn_prepare_delete is called twice. First time is directly from lwip_close-> netconn_prepare_delete Second time is via lwip_close-> free_socket-> free_socket_free_elements->
netconn_delete-> netconn_prepare_delete The second time could be avoided if LWIP_NETCONN_FULLDUPLEX is set in which case there is a test for it, but I see that is flag is in alpha state and if not needed it is a bit strange to enable it just for this ? But maybe I am misunderstanding something ? Regards, Bram |
[Prev in Thread] | Current Thread | [Next in Thread] |