mirror of
https://github.com/TokTok/c-toxcore
synced 2026-06-07 06:42:39 +00:00
The stuff in do_DHT only need to be run once per second.
Should lower CPU usage by a bit.
This commit is contained in:
+4
-1
@@ -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)
|
||||
{
|
||||
|
||||
@@ -149,6 +149,8 @@ typedef struct {
|
||||
PING *ping;
|
||||
|
||||
Assoc *assoc;
|
||||
|
||||
uint64_t last_run;
|
||||
} DHT;
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user