-/* Purge edges of unreachable nodes. Use carefully. */
-
-// TODO: remove
-void purge(void) {
- logger(DEBUG_PROTOCOL, LOG_DEBUG, "Purging unreachable nodes");
-
- /* Remove all edges owned by unreachable nodes. */
-
- for splay_each(node_t, n, mesh->nodes) {
- if(!n->status.reachable) {
- logger(DEBUG_SCARY_THINGS, LOG_DEBUG, "Purging node %s (%s)", n->name, n->hostname);
-
- for splay_each(edge_t, e, n->edge_tree) {
- send_del_edge(mesh->everyone, e);
- edge_del(e);
- }
- }
- }
-
- /* Check if anyone else claims to have an edge to an unreachable node. If not, delete node. */
-
- for splay_each(node_t, n, mesh->nodes) {
- if(!n->status.reachable) {
- for splay_each(edge_t, e, mesh->edges)
- if(e->to == n)
- return;
- }
- }
-}
-