X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Faddress_cache.c;h=381ae785a1d3ff46b689cd4239b51ec4c887b339;hb=8f73169567fed6703acbad4f0f5fd5cff700d619;hp=ff5850c97a8de38088029ec2c4e7004cd5c0ab17;hpb=536fe3ffcdc4c894ed986dfb5fdc0d6f78d6fe25;p=tinc diff --git a/src/address_cache.c b/src/address_cache.c index ff5850c9..381ae785 100644 --- a/src/address_cache.c +++ b/src/address_cache.c @@ -85,14 +85,16 @@ void add_recent_address(address_cache_t *cache, const sockaddr_t *sa) { unsigned int pos = find_cached(cache, sa); // It's in the first spot, so nothing to do - if (pos == 0) { + if(pos == 0) { return; } // Shift everything, move/add the address to the first slot if(pos == NOT_CACHED) { - if(cache->data.used < MAX_CACHED_ADDRESSES) + if(cache->data.used < MAX_CACHED_ADDRESSES) { cache->data.used++; + } + pos = cache->data.used - 1; }