X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Faddress_cache.c;fp=src%2Faddress_cache.c;h=f28dbf902d003d9fee443c0494bbeef95af13478;hp=d9996fb0b53f6fc354a8899b305a442c96ce1172;hb=c6a15e27d934e90a1f3a26438dddb395bdc9de19;hpb=1695d8828ed6fb997dbd96e21c105ab5641b90c5 diff --git a/src/address_cache.c b/src/address_cache.c index d9996fb0..f28dbf90 100644 --- a/src/address_cache.c +++ b/src/address_cache.c @@ -25,7 +25,7 @@ #include "netutl.h" #include "xalloc.h" -static const unsigned int NOT_CACHED = -1; +static const unsigned int NOT_CACHED = UINT_MAX; // Find edges pointing to this node, and use them to build a list of unique, known addresses. static struct addrinfo *get_known_addresses(node_t *n) { @@ -90,6 +90,8 @@ void add_recent_address(address_cache_t *cache, const sockaddr_t *sa) { return; } + logger(DEBUG_CONNECTIONS, LOG_DEBUG, "Caching recent address for %s", cache->node->name); + // Shift everything, move/add the address to the first slot if(pos == NOT_CACHED) { if(cache->data.used < MAX_CACHED_ADDRESSES) { @@ -216,7 +218,7 @@ const sockaddr_t *get_recent_address(address_cache_t *cache) { exit_configuration(cache->config_tree); cache->config_tree = NULL; - return false; + return NULL; } address_cache_t *open_address_cache(node_t *node) { @@ -251,11 +253,7 @@ address_cache_t *open_address_cache(node_t *node) { return cache; } -void reset_address_cache(address_cache_t *cache, const sockaddr_t *sa) { - if(sa) { - add_recent_address(cache, sa); - } - +void reset_address_cache(address_cache_t *cache) { if(cache->config_tree) { exit_configuration(cache->config_tree); cache->config_tree = NULL;