MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / netconn_delete

Function netconn_delete

components/net/lwip/lwip-2.1.2/src/api/api_lib.c:232–255  ·  view source on GitHub ↗

* @ingroup netconn_common * Close a netconn 'connection' and free its resources. * UDP and RAW connection are completely closed, TCP pcbs might still be in a waitstate * after this returns. * * @param conn the netconn to delete * @return ERR_OK if the connection was deleted */

Source from the content-addressed store, hash-verified

230 * @return ERR_OK if the connection was deleted
231 */
232err_t
233netconn_delete(struct netconn *conn)
234{
235 err_t err;
236
237 /* No ASSERT here because possible to get a (conn == NULL) if we got an accept error */
238 if (conn == NULL) {
239 return ERR_OK;
240 }
241
242#if LWIP_NETCONN_FULLDUPLEX
243 if (conn->flags & NETCONN_FLAG_MBOXINVALID) {
244 /* Already called netconn_prepare_delete() before */
245 err = ERR_OK;
246 } else
247#endif /* LWIP_NETCONN_FULLDUPLEX */
248 {
249 err = netconn_prepare_delete(conn);
250 }
251 if (err == ERR_OK) {
252 netconn_free(conn);
253 }
254 return err;
255}
256
257/**
258 * Get the local or remote IP address and port of a netconn.

Callers 6

lwip_acceptFunction · 0.70
lwip_socketFunction · 0.70
drv_ethernet.cFile · 0.50
udpecho_entryFunction · 0.50
tcpecho_entryFunction · 0.50

Calls 2

netconn_prepare_deleteFunction · 0.85
netconn_freeFunction · 0.70

Tested by 2

udpecho_entryFunction · 0.40
tcpecho_entryFunction · 0.40