diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-08-09 23:53:39 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-08-16 21:01:38 +0000 |
commit | 54066f338f185f2fbd6694d9a4877f42cbfa21c8 (patch) | |
tree | e056e50af1009bf373c040812e46cd1de8de9979 /other/bootstrap_daemon | |
parent | 31ea1aa06e59d24d5196b17be9a7105d85c25080 (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 'other/bootstrap_daemon')
-rw-r--r-- | other/bootstrap_daemon/src/tox-bootstrapd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c index b17fc2ba..d75018d8 100644 --- a/other/bootstrap_daemon/src/tox-bootstrapd.c +++ b/other/bootstrap_daemon/src/tox-bootstrapd.c | |||
@@ -230,6 +230,8 @@ int main(int argc, char *argv[]) | |||
230 | IP ip; | 230 | IP ip; |
231 | ip_init(&ip, enable_ipv6); | 231 | ip_init(&ip, enable_ipv6); |
232 | 232 | ||
233 | unix_time_update(); | ||
234 | |||
233 | Logger *logger = logger_new(); | 235 | Logger *logger = logger_new(); |
234 | 236 | ||
235 | Networking_Core *net = new_networking(logger, ip, port); | 237 | Networking_Core *net = new_networking(logger, ip, port); |
@@ -336,6 +338,8 @@ int main(int argc, char *argv[]) | |||
336 | } | 338 | } |
337 | 339 | ||
338 | while (1) { | 340 | while (1) { |
341 | unix_time_update(); | ||
342 | |||
339 | do_dht(dht); | 343 | do_dht(dht); |
340 | 344 | ||
341 | if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) { | 345 | if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) { |