projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Throttle the rate of UDP_INFO messages.
[tinc]
/
src
/
protocol_misc.c
diff --git
a/src/protocol_misc.c
b/src/protocol_misc.c
index
5fde833
..
d76ab09
100644
(file)
--- a/
src/protocol_misc.c
+++ b/
src/protocol_misc.c
@@
-31,6
+31,7
@@
#include "xalloc.h"
int maxoutbufsize = 0;
#include "xalloc.h"
int maxoutbufsize = 0;
+int udp_info_interval = 5;
/* Status and error notification routines */
/* 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(!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;
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);
free(from_address);
free(from_port);
+ if(from == myself)
+ to->udp_info_sent = now;
+
return x;
}
return x;
}