projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d73cdee
)
Forward-port tinc 1.0's handling of device errors.
author
Guus Sliepen
<guus@tinc-vpn.org>
Thu, 27 Jul 2017 08:06:13 +0000
(10:06 +0200)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Thu, 27 Jul 2017 08:06:42 +0000
(10:06 +0200)
src/net_packet.c
patch
|
blob
|
history
diff --git
a/src/net_packet.c
b/src/net_packet.c
index
71f02a1
..
ed04a85
100644
(file)
--- a/
src/net_packet.c
+++ b/
src/net_packet.c
@@
-1573,10
+1573,19
@@
void handle_device_data(void *data, int flags) {
vpn_packet_t packet;
packet.offset = DEFAULT_PACKET_OFFSET;
packet.priority = 0;
+ static int errors = 0;
if(devops.read(&packet)) {
+ errors = 0;
myself->in_packets++;
myself->in_bytes += packet.len;
route(myself, &packet);
+ } else {
+ usleep(errors * 50000);
+ errors++;
+ if(errors > 10) {
+ logger(DEBUG_ALWAYS, LOG_ERR, "Too many errors from %s, exiting!", device);
+ event_exit();
+ }
}
}