X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_packet.c;h=5d559bd88b1340c7d3de3de268b3549523d1e9a1;hb=4e5c2193a1fa1ed054956fc0b1df387b19c546a5;hp=71f02a1e0e24c67148775918416511811327646c;hpb=e6497a23f7689663aa2c19311a278e20661bddc1;p=tinc diff --git a/src/net_packet.c b/src/net_packet.c index 71f02a1e..5d559bd8 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -1,7 +1,7 @@ /* net_packet.c -- Handles in- and outgoing VPN packets Copyright (C) 1998-2005 Ivo Timmermans, - 2000-2016 Guus Sliepen + 2000-2017 Guus Sliepen 2010 Timothy Redaelli 2010 Brandon Black @@ -846,6 +846,7 @@ bool receive_sptps_record(void *handle, uint8_t type, const void *data, uint16_t vpn_packet_t inpkt; inpkt.offset = DEFAULT_PACKET_OFFSET; + inpkt.priority = 0; if(type == PKT_PROBE) { if(!from->status.udppacket) { @@ -1573,10 +1574,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(); + } } }