diff options
author | Micah Elizabeth Scott <beth@torproject.org> | 2023-02-21 17:06:17 -0800 |
---|---|---|
committer | Micah Elizabeth Scott <beth@torproject.org> | 2023-05-10 07:37:11 -0700 |
commit | 09afc5eacf67d83cd75b3a659fc23a6120e0033e (patch) | |
tree | 4808e2f027a6f67ea625266deab0829793924d2e /src/feature/hs/hs_service.c | |
parent | eba919093320a995a10637170fcc881a4c2c2dd9 (diff) | |
download | tor-09afc5eacf67d83cd75b3a659fc23a6120e0033e.tar.gz tor-09afc5eacf67d83cd75b3a659fc23a6120e0033e.zip |
update_suggested_effort: avoid assert if the pqueue has emptied
top_of_rend_pqueue_is_worthwhile requires a nonempty queue.
Diffstat (limited to 'src/feature/hs/hs_service.c')
-rw-r--r-- | src/feature/hs/hs_service.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c index b50f996fbd..d67fead791 100644 --- a/src/feature/hs/hs_service.c +++ b/src/feature/hs/hs_service.c @@ -2689,7 +2689,8 @@ update_suggested_effort(hs_service_t *service, time_t now) /* If we had a queue during this period, and the current top of queue * is at or above the suggested effort, we should re-estimate the effort. * Otherwise, it can stay the same (no change to effort). */ - if (top_of_rend_pqueue_is_worthwhile(pow_state)) { + if (smartlist_len(pow_state->rend_request_pqueue) > 0 && + top_of_rend_pqueue_is_worthwhile(pow_state)) { pow_state->suggested_effort = (uint32_t)(pow_state->total_effort / pow_state->rend_handled); } |