diff --git a/toxcore/DHT.c b/toxcore/DHT.c index f49858bc2..236b8c164 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c @@ -1662,11 +1662,14 @@ DHT *new_DHT(Net_Crypto *c) void do_DHT(DHT *dht) { unix_time_update(); - + if (dht->last_run == unix_time()) { + return; + } do_Close(dht); do_DHT_friends(dht); do_NAT(dht); do_toping(dht->ping); + dht->last_run = unix_time(); } void kill_DHT(DHT *dht) { diff --git a/toxcore/DHT.h b/toxcore/DHT.h index 2f6334ee4..37328e5d7 100644 --- a/toxcore/DHT.h +++ b/toxcore/DHT.h @@ -149,6 +149,8 @@ typedef struct { PING *ping; Assoc *assoc; + + uint64_t last_run; } DHT; /*----------------------------------------------------------------------------------*/