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

Function free_socket

components/net/lwip/lwip-2.1.2/src/api/sockets.c:615–633  ·  view source on GitHub ↗

Free a socket. The socket's netconn must have been * delete before! * * @param sock the socket to free * @param is_tcp != 0 for TCP sockets, used to free lastdata */

Source from the content-addressed store, hash-verified

613 * @param is_tcp != 0 for TCP sockets, used to free lastdata
614 */
615static void
616free_socket(struct lwip_sock *sock, int is_tcp)
617{
618 int freed;
619 struct netconn *conn;
620 union lwip_sock_lastdata lastdata;
621 SYS_ARCH_DECL_PROTECT(lev);
622
623 /* Protect socket array */
624 SYS_ARCH_PROTECT(lev);
625
626 freed = free_socket_locked(sock, is_tcp, &conn, &lastdata);
627 SYS_ARCH_UNPROTECT(lev);
628 /* don't use 'sock' after this line, as another task might have allocated it */
629
630 if (freed) {
631 free_socket_free_elements(is_tcp, conn, &lastdata);
632 }
633}
634
635/* Below this, the well-known socket functions are implemented.
636 * Use google.com or opengroup.org to get a good description :-)

Callers 2

lwip_acceptFunction · 0.70
lwip_closeFunction · 0.70

Calls 2

free_socket_lockedFunction · 0.85

Tested by

no test coverage detected