node_t *n = (node_t *)node;
connection_t *c = n->connection;
+ n->catta_address = naddress;
node_add_recent_address(mesh, n, &naddress);
if(c && c->outgoing && !c->status.active) {
return;
}
+ /* If we have learned an address via Catta, try this once every batch */
+ if(mesh->udp_choice == 1 && n->catta_address.sa.sa_family != AF_UNSPEC) {
+ *sa = &n->catta_address;
+ goto check_socket;
+ }
+
/* Otherwise, address are found in edges to this node.
So we pick a random edge and a random socket. */
*sock = prng(mesh, mesh->listen_sockets);
}
+check_socket:
/* Make sure we have a suitable socket for the chosen address */
if(mesh->listen_socket[*sock].sa.sa.sa_family != (*sa)->sa.sa_family) {
for(int i = 0; i < mesh->listen_sockets; i++) {
time_t last_successfull_connection;
char *canonical_address; /* The canonical address of this node, if known */
- sockaddr_t recent[MAX_RECENT]; /* Recently seen addresses */
+ sockaddr_t recent[MAX_RECENT]; /* Recently seen addresses */
+ sockaddr_t catta_address; /* Latest address seen by Catta */
// Graph-related member variables
time_t last_reachable;