X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_packet.c;h=ed04a85d55bcaf8cad78492d9881f9c93917df15;hb=00d81ee6236e76f80b84372ac5c635636ad48136;hp=71f02a1e0e24c67148775918416511811327646c;hpb=e6497a23f7689663aa2c19311a278e20661bddc1;p=tinc diff --git a/src/net_packet.c b/src/net_packet.c index 71f02a1e..ed04a85d 100644 --- 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(); + } } }