void done_bittorrent_listening_socket(struct connection *conn) { struct bittorrent_connection *connection, *bittorrent = conn->info; /* The bittorrent connection might not even have been added if the * request for the metainfo file failed so carefully look it up. */ foreach (connection, bittorrent_connections) if (connection == bittorrent) { del_from_list(bittorrent); break; } /* If there are no more connections left remove all pending peer * connections. */ if (list_empty(bittorrent_connections)) { struct bittorrent_peer_connection *peer, *next; foreachsafe (peer, next, bittorrent_peer_connections) done_bittorrent_peer_connection(peer); } /* Close the listening socket. */ if (bittorrent_socket != -1) { /* Unregister the socket from the select() loop mechanism. */ clear_handlers(bittorrent_socket); close(bittorrent_socket); bittorrent_socket = -1; } }
static void delete_cookie_item(struct listbox_item *item, int last) { struct cookie *cookie = (struct cookie *)item->udata; if (item->type == BI_FOLDER) { struct listbox_item *next, *root = item; /* Releasing refcounts on the cookie_server will automagically * delete it. */ foreachsafe (item, next, root->child) delete_cookie_item(item, 0); } else { assert(!is_object_used(cookie)); delete_cookie(cookie); set_cookies_dirty(); } }