socket: Purge rx queue when socket closes?

This commit is contained in:
K. Lange 2021-10-23 12:42:48 +09:00
parent 43772cbbb0
commit ce1e9b4e03

View File

@ -93,6 +93,11 @@ int sock_generic_wait(fs_node_t *node, void * process) {
void sock_generic_close(fs_node_t *node) { void sock_generic_close(fs_node_t *node) {
sock_t * sock = (sock_t*)node; sock_t * sock = (sock_t*)node;
sock->sock_close(sock); sock->sock_close(sock);
while (sock->rx_queue->length) {
node_t * n = list_dequeue(sock->rx_queue);
free(n->value);
free(n);
}
printf("net: socket closed\n"); printf("net: socket closed\n");
} }