projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Attempt to make the test suite work with Windows executables.
[tinc]
/
src
/
address_cache.c
diff --git
a/src/address_cache.c
b/src/address_cache.c
index
2fa9baf
..
b6d48d0
100644
(file)
--- a/
src/address_cache.c
+++ b/
src/address_cache.c
@@
-108,7
+108,6
@@
void add_recent_address(address_cache_t *cache, const sockaddr_t *sa) {
FILE *fp = fopen(fname, "wb");
if(fp) {
FILE *fp = fopen(fname, "wb");
if(fp) {
- fprintf(stderr, "Writing cache to %s\n", fname);
fwrite(&cache->data, sizeof(cache->data), 1, fp);
fclose(fp);
}
fwrite(&cache->data, sizeof(cache->data), 1, fp);
fclose(fp);
}
@@
-129,12
+128,12
@@
const sockaddr_t *get_recent_address(address_cache_t *cache) {
if(cache->ai) {
if(cache->aip) {
sockaddr_t *sa = (sockaddr_t *)cache->aip->ai_addr;
if(cache->ai) {
if(cache->aip) {
sockaddr_t *sa = (sockaddr_t *)cache->aip->ai_addr;
+ cache->aip = cache->aip->ai_next;
if(find_cached(cache, sa) != NOT_CACHED) {
continue;
}
if(find_cached(cache, sa) != NOT_CACHED) {
continue;
}
- cache->aip = cache->aip->ai_next;
return sa;
} else {
free_known_addresses(cache->ai);
return sa;
} else {
free_known_addresses(cache->ai);
@@
-152,7
+151,7
@@
const sockaddr_t *get_recent_address(address_cache_t *cache) {
cache->cfg = lookup_config(cache->config_tree, "Address");
}
cache->cfg = lookup_config(cache->config_tree, "Address");
}
- while(cache->cfg && !cache->ai) {
+ while(cache->cfg && !cache->ai
p
) {
char *address, *port;
get_config_string(cache->cfg, &address);
char *address, *port;
get_config_string(cache->cfg, &address);
@@
-168,6
+167,10
@@
const sockaddr_t *get_recent_address(address_cache_t *cache) {
}
}
}
}
+ if(cache->ai) {
+ free_known_addresses(cache->ai);
+ }
+
cache->aip = cache->ai = str2addrinfo(address, port, SOCK_STREAM);
if(cache->ai) {
cache->aip = cache->ai = str2addrinfo(address, port, SOCK_STREAM);
if(cache->ai) {