diff options
author | David Goulet <dgoulet@torproject.org> | 2023-05-24 11:45:40 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2023-05-24 11:45:40 -0400 |
commit | a2ec9a1199dbcad9e7ffada3e324c8cb81c8a192 (patch) | |
tree | 35a031b94a79db5b15cf6156c23ec0b02a753996 /src/core | |
parent | 9976da93679acc422c174f5e5b5bf890e387f1b1 (diff) | |
parent | 23f4a28f9755a228ab295d5358298f1a72f8aff1 (diff) | |
download | tor-a2ec9a1199dbcad9e7ffada3e324c8cb81c8a192.tar.gz tor-a2ec9a1199dbcad9e7ffada3e324c8cb81c8a192.zip |
Merge branch 'tor-gitlab/mr/711'
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/or/dos.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/or/dos.c b/src/core/or/dos.c index 11a0edcc6a..8e0fe9e641 100644 --- a/src/core/or/dos.c +++ b/src/core/or/dos.c @@ -21,6 +21,7 @@ #include "feature/relay/routermode.h" #include "feature/stats/geoip_stats.h" #include "lib/crypt_ops/crypto_rand.h" +#include "lib/time/compat_time.h" #include "core/or/dos.h" #include "core/or/dos_sys.h" @@ -528,7 +529,8 @@ conn_update_on_connect(conn_client_stats_t *stats, const tor_addr_t *addr) stats->concurrent_count++; /* Refill connect connection count. */ - token_bucket_ctr_refill(&stats->connect_count, (uint32_t) approx_time()); + token_bucket_ctr_refill(&stats->connect_count, + (uint32_t) monotime_coarse_absolute_sec()); /* Decrement counter for this new connection. */ if (token_bucket_ctr_get(&stats->connect_count) > 0) { @@ -808,7 +810,7 @@ dos_geoip_entry_init(clientmap_entry_t *geoip_ent) * can be enabled at runtime and these counters need to be valid. */ token_bucket_ctr_init(&geoip_ent->dos_stats.conn_stats.connect_count, dos_conn_connect_rate, dos_conn_connect_burst, - (uint32_t) approx_time()); + (uint32_t) monotime_coarse_absolute_sec()); } /** Note that the given channel has sent outbound the maximum amount of cell |