Skip to content

Commit

Permalink
only run pre_callbacks if the caller tells us to wait
Browse files Browse the repository at this point in the history
only the network & worker threads use the pre callbacks.  And,
the only thing they do is lower the wait time.  So if we're told
to not wait, then don't bother asking caller if the timers
should be lowered.
  • Loading branch information
alandekok committed Dec 19, 2019
1 parent 4773244 commit 1ba7ac3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/lib/util/event.c
Expand Up @@ -1478,13 +1478,18 @@ int fr_event_corral(fr_event_list_t *el, fr_time_t now, bool wait)
* Run the status callbacks. It may tell us that the
* application has more work to do, in which case we
* re-set the timeout to be instant.
*
* We only run these callbacks if the caller is otherwise
* idle.
*/
for (pre = fr_dlist_head(&el->pre_callbacks);
pre != NULL;
pre = fr_dlist_next(&el->pre_callbacks, pre)) {
if (pre->callback(pre->uctx, wake ? *wake : 0) > 0) {
wake = &when;
when = 0;
if (wait) {
for (pre = fr_dlist_head(&el->pre_callbacks);
pre != NULL;
pre = fr_dlist_next(&el->pre_callbacks, pre)) {
if (pre->callback(pre->uctx, wake ? *wake : 0) > 0) {
wake = &when;
when = 0;
}
}
}

Expand Down

0 comments on commit 1ba7ac3

Please sign in to comment.