From: Guus Sliepen Date: Sat, 17 Feb 2018 13:39:29 +0000 (+0100) Subject: Reformat all code using astyle. X-Git-Tag: release-1.1pre16~26 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=d2b03f006f98d504e3e30f2d4b91ce02abd19c51;p=tinc Reformat all code using astyle. --- 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; } diff --git a/src/event.c b/src/event.c index 84b18b3d..331872a5 100644 --- a/src/event.c +++ b/src/event.c @@ -41,12 +41,15 @@ static int io_compare(const io_t *a, const io_t *b) { #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 } diff --git a/src/mingw/device.c b/src/mingw/device.c index eb3663d7..2cce1f2b 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -72,6 +72,7 @@ static void device_issue_read() { 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)); diff --git a/src/net_packet.c b/src/net_packet.c index c8f48d32..d37f2202 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -158,8 +158,11 @@ static void udp_probe_h(node_t *n, vpn_packet_t *packet, length_t len) { 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); } diff --git a/src/net_socket.c b/src/net_socket.c index 4fbcf57d..cd6a5c2f 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -815,11 +815,13 @@ void try_outgoing_connections(void) { 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);