void net_socket_private::RemoveFromParent() { ASSERT(!is_in_socket_list && parent != NULL); parent = NULL; mutex_lock(&sSocketLock); sSocketList.Add(this); mutex_unlock(&sSocketLock); is_in_socket_list = true; ReleaseReference(); }
status_t socket_open(int family, int type, int protocol, net_socket** _socket) { net_socket_private* socket; status_t status = create_socket(family, type, protocol, &socket); if (status != B_OK) return status; status = socket->first_info->open(socket->first_protocol); if (status != B_OK) { delete socket; return status; } socket->owner = team_get_current_team_id(); socket->is_in_socket_list = true; mutex_lock(&sSocketLock); sSocketList.Add(socket); mutex_unlock(&sSocketLock); *_socket = socket; return B_OK; }