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 */
| 613 | * @param is_tcp != 0 for TCP sockets, used to free lastdata |
| 614 | */ |
| 615 | static void |
| 616 | free_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 :-) |
no test coverage detected