Choose a suitable socket when updating a node's UDP address.
This commit is contained in:
parent
8f9ee89522
commit
30404650b2
1 changed files with 7 additions and 0 deletions
|
@ -129,6 +129,13 @@ void update_node_udp(node_t *n, const sockaddr_t *sa) {
|
|||
|
||||
if(sa) {
|
||||
n->address = *sa;
|
||||
n->sock = 0;
|
||||
for(int i = 0; i < listen_sockets; i++) {
|
||||
if(listen_socket[i].sa.sa.sa_family == sa->sa.sa_family) {
|
||||
n->sock = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
hash_insert(node_udp_cache, sa, n);
|
||||
free(n->hostname);
|
||||
n->hostname = sockaddr2hostname(&n->address);
|
||||
|
|
Loading…
Reference in a new issue