X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=inline;f=src%2Fnode.c;h=5dc3119fb9b19ca10dddabd1877cdf517d74b342;hb=30404650b28bf72d0b05b55393f2dd492434f9f3;hp=740b9448639a9cde7e664634cfc99651ac4620b1;hpb=d917c8cb6b69475d568ccbe82389b9f2b3eb5e80;p=meshlink diff --git a/src/node.c b/src/node.c index 740b9448..5dc3119f 100644 --- a/src/node.c +++ b/src/node.c @@ -1,6 +1,6 @@ /* node.c -- node tree management - Copyright (C) 2001-2011 Guus Sliepen , + Copyright (C) 2001-2012 Guus Sliepen , 2001-2005 Ivo Timmermans This program is free software; you can redistribute it and/or modify @@ -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);