summaryrefslogtreecommitdiff
path: root/src/feature/relay/onion_queue.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-11-23 14:54:43 -0500
committerDavid Goulet <dgoulet@torproject.org>2022-11-23 14:54:43 -0500
commit0f72752037a338698385f04d7e07c934336972f7 (patch)
treee7ab929c559c84c27dfd878c9ccae3ffc5926dff /src/feature/relay/onion_queue.c
parentaf4fff5ec61c3de012e690679998c96dc6a5ccb1 (diff)
parentfbc9e92fdb364a741a3190fc22c6fa65d90e92e3 (diff)
downloadtor-0f72752037a338698385f04d7e07c934336972f7.tar.gz
tor-0f72752037a338698385f04d7e07c934336972f7.zip
Merge branch 'maint-0.4.7' into release-0.4.7
Diffstat (limited to 'src/feature/relay/onion_queue.c')
-rw-r--r--src/feature/relay/onion_queue.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/feature/relay/onion_queue.c b/src/feature/relay/onion_queue.c
index 6d1a6de15c..b844aefcd1 100644
--- a/src/feature/relay/onion_queue.c
+++ b/src/feature/relay/onion_queue.c
@@ -152,7 +152,13 @@ have_room_for_onionskin(uint16_t type)
/* If we've got fewer than 50 entries, we always have room for one more. */
if (ol_entries[type] < 50)
return 1;
- num_cpus = get_num_cpus(options);
+
+ /* If zero, this means our thread pool was never initialized meaning we can't
+ * really get here but make sure we don't have such value because we are
+ * using as a divisor. */
+ num_cpus = cpuworker_get_n_threads();
+ tor_assert(num_cpus > 0);
+
max_onion_queue_delay = get_onion_queue_max_delay(options);
/* Compute how many microseconds we'd expect to need to clear all