#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) {
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) {
}
// We're all out of addresses.
- exit_configuration(&cache->config_tree);
- return false;
+ exit_configuration(cache->config_tree);
+ cache->config_tree = NULL;
+
+ return NULL;
}
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);
+ exit_configuration(cache->config_tree);
+ cache->config_tree = NULL;
}
if(cache->ai) {
void close_address_cache(address_cache_t *cache) {
if(cache->config_tree) {
- exit_configuration(&cache->config_tree);
+ exit_configuration(cache->config_tree);
+ cache->config_tree = NULL;
}
if(cache->ai) {