summaryrefslogtreecommitdiff
path: root/toxcore/net_crypto.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-08-09 23:53:39 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-08-16 21:01:38 +0000
commit54066f338f185f2fbd6694d9a4877f42cbfa21c8 (patch)
treee056e50af1009bf373c040812e46cd1de8de9979 /toxcore/net_crypto.c
parent31ea1aa06e59d24d5196b17be9a7105d85c25080 (diff)
Reduce the number of times `unix_time_update` is called.
Reduced by, e.g.: * `file_transfer_test`: 33% of the `clock_gettime` calls. * `tox_many_test`: 53% of the `clock_gettime` calls. Other tests will see similar improvements. Real world applications will be closer to 40-50% improvement, since tox_many_test has 100 nodes, while file_transfer_test has 2 nodes.
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r--toxcore/net_crypto.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c
index 8f5fd507..bd214b91 100644
--- a/toxcore/net_crypto.c
+++ b/toxcore/net_crypto.c
@@ -2925,8 +2925,6 @@ void load_secret_key(Net_Crypto *c, const uint8_t *sk)
2925 */ 2925 */
2926Net_Crypto *new_net_crypto(const Logger *log, DHT *dht, TCP_Proxy_Info *proxy_info) 2926Net_Crypto *new_net_crypto(const Logger *log, DHT *dht, TCP_Proxy_Info *proxy_info)
2927{ 2927{
2928 unix_time_update();
2929
2930 if (dht == nullptr) { 2928 if (dht == nullptr) {
2931 return nullptr; 2929 return nullptr;
2932 } 2930 }
@@ -3016,7 +3014,6 @@ uint32_t crypto_run_interval(const Net_Crypto *c)
3016/* Main loop. */ 3014/* Main loop. */
3017void do_net_crypto(Net_Crypto *c, void *userdata) 3015void do_net_crypto(Net_Crypto *c, void *userdata)
3018{ 3016{
3019 unix_time_update();
3020 kill_timedout(c, userdata); 3017 kill_timedout(c, userdata);
3021 do_tcp(c, userdata); 3018 do_tcp(c, userdata);
3022 send_crypto_packets(c); 3019 send_crypto_packets(c);