- check->status.visited = 1;
- check->nexthop = (n->nexthop == myself)?n:n->nexthop;
- check->via = check; /* FIXME: only if !(e->options & INDIRECT), otherwise use n->via */
- avl_insert_before(todo_tree, todo_tree->head, to);
- visited++;
+ to_hc.node->status.visited = 1;
+ to_hc.node->nexthop = (n->nexthop == myself) ? to_hc.node : n->nexthop;
+ to_hc.node->via = (e->options & OPTION_INDIRECT || n->via != n) ? n->via : to_hc.node;
+ to_hc.node->options = e->options;
+ if(to_hc.node->address != to_hc.address || to_hc.node->port != to_hc.port)
+ {
+ node = avl_unlink(node_udp_tree, to_hc.node);
+ to_hc.node->address = to_hc.address;
+ to_hc.node->port = to_hc.port;
+ if(to_hc.node->hostname)
+ free(to_hc.node->hostname);
+ to_hc.node->hostname = hostlookup(htonl(to_hc.address));
+ avl_insert_node(node_udp_tree, node);
+ }
+ to_hc.node->port = to_hc.port;
+ node = avl_alloc_node();
+ node->data = to_hc.node;
+ avl_insert_before(todo_tree, from, node);