* When deleting a socket, we also need to delete all of its children.

* This fixes a KDL I often seen when launching firefox.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24046 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-02-21 15:00:19 +00:00
parent 0dd3108ca0
commit 0db772c937

View File

@ -65,6 +65,21 @@ compute_user_iovec_length(iovec *userVec, uint32 count)
}
static void
delete_children(struct list *list)
{
while (true) {
net_socket_private *child
= (net_socket_private *)list_remove_head_item(list);
if (child == NULL)
break;
child->parent = NULL;
socket_delete(child);
}
}
static status_t
create_socket(int family, int type, int protocol, net_socket_private **_socket)
{
@ -364,6 +379,10 @@ socket_delete(net_socket *_socket)
list_remove_item(&sSocketList, socket);
benaphore_unlock(&sSocketLock);
// also delete all children of this socket
delete_children(&socket->pending_children);
delete_children(&socket->connected_children);
put_domain_protocols(socket);
benaphore_destroy(&socket->lock);
delete_select_sync_pool(socket->select_pool);