X-Git-Url: http://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprotocol_misc.c;h=d76ab0933a21f61c1591fda9602f3714a0727578;hb=467397f25d3a99ec1a97d4419502c37b64276f49;hp=5fde83326342b9dd295b4da609623023ee8dd102;hpb=b1421b919090351e885ed3d06df67fb2eb69e765;p=tinc diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 5fde8332..d76ab093 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -31,6 +31,7 @@ #include "xalloc.h" int maxoutbufsize = 0; +int udp_info_interval = 5; /* Status and error notification routines */ @@ -167,8 +168,15 @@ bool send_udp_info(node_t *from, node_t *to) { if(!to->status.reachable) return true; - if(from == myself && to->connection) - return true; + if(from == myself) { + if(to->connection) + return true; + + struct timeval elapsed; + timersub(&now, &to->udp_info_sent, &elapsed); + if(elapsed.tv_sec < udp_info_interval) + return true; + } if((myself->options | from->options | to->options) & OPTION_TCPONLY) return true; @@ -188,6 +196,9 @@ bool send_udp_info(node_t *from, node_t *to) { free(from_address); free(from_port); + if(from == myself) + to->udp_info_sent = now; + return x; }