* @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 */
| 230 | * @return ERR_OK if the connection was deleted |
| 231 | */ |
| 232 | err_t |
| 233 | netconn_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. |