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;
}
#ifndef HAVE_MINGW
return a->fd - b->fd;
#else
+
if(a->event < b->event) {
return -1;
}
+
if(a->event > b->event) {
return 1;
}
+
return 0;
#endif
}
static void device_handle_read(void *data, int flags) {
DWORD len;
+
if(!GetOverlappedResult(device_handle, &device_read_overlapped, &len, FALSE)) {
logger(DEBUG_ALWAYS, LOG_ERR, "Error getting read result from %s %s: %s", device_info,
device, strerror(errno));
if(!n->status.udp_confirmed) {
n->status.udp_confirmed = true;
fprintf(stderr, "Updating address cache...\n");
- if (!n->address_cache)
+
+ if(!n->address_cache) {
n->address_cache = open_address_cache(n);
+ }
+
reset_address_cache(n->address_cache, &n->address);
}
if(!found) {
outgoing_t *outgoing = xzalloc(sizeof(*outgoing));
node_t *n = lookup_node(name);
+
if(!n) {
n = new_node();
n->name = xstrdup(name);
node_add(n);
}
+
outgoing->node = n;
list_insert_tail(outgoing_list, outgoing);
setup_outgoing_connection(outgoing, true);