diff options
author | David Goulet <dgoulet@torproject.org> | 2018-01-31 14:15:02 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-01-31 14:15:02 -0500 |
commit | fbc455cbd224aaf28c613ed92bbaee656291efec (patch) | |
tree | 40486321ab7fda0b61fd3da012e42fec3853fa67 /src/or/scheduler.h | |
parent | c85f78e74c52d19b575618d031e67b64210c14fc (diff) | |
download | tor-fbc455cbd224aaf28c613ed92bbaee656291efec.tar.gz tor-fbc455cbd224aaf28c613ed92bbaee656291efec.zip |
ns: Add a before and after consensus has changed notification
In 0.3.2.1-alpha, we've added notify_networkstatus_changed() in order to have
a way to notify other subsystems that the consensus just changed. The old and
new consensus are passed to it.
Before this patch, this was done _before_ the new consensus was set globally
(thus NOT accessible by getting the latest consensus). The scheduler
notification was assuming that it was set and select_scheduler() is looking at
the latest consensus to get the parameters it might needs. This was very wrong
because at that point it is still the old consensus set globally.
This commit changes the notify_networkstatus_changed() to be the "before"
function and adds an "after" notification from which the scheduler subsystem
is notified.
Fixes #24975
Diffstat (limited to 'src/or/scheduler.h')
-rw-r--r-- | src/or/scheduler.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/or/scheduler.h b/src/or/scheduler.h index 47c98f096a..559f1c8afc 100644 --- a/src/or/scheduler.h +++ b/src/or/scheduler.h @@ -80,8 +80,7 @@ typedef struct scheduler_s { * (which might be new) will call this so it has the chance to react to the * new consensus too. If there's a consensus parameter that your scheduler * wants to keep an eye on, this is where you should check for it. */ - void (*on_new_consensus)(const networkstatus_t *old_c, - const networkstatus_t *new_c); + void (*on_new_consensus)(void); /* (Optional) To be called when a channel is being freed. Sometimes channels * go away (for example: the relay on the other end is shutting down). If @@ -119,8 +118,7 @@ typedef struct scheduler_s { void scheduler_init(void); void scheduler_free_all(void); void scheduler_conf_changed(void); -void scheduler_notify_networkstatus_changed(const networkstatus_t *old_c, - const networkstatus_t *new_c); +void scheduler_notify_networkstatus_changed(void); MOCK_DECL(void, scheduler_release_channel, (channel_t *chan)); /* @@ -197,7 +195,7 @@ int scheduler_can_use_kist(void); void scheduler_kist_set_full_mode(void); void scheduler_kist_set_lite_mode(void); scheduler_t *get_kist_scheduler(void); -int kist_scheduler_run_interval(const networkstatus_t *ns); +int kist_scheduler_run_interval(void); #ifdef TOR_UNIT_TESTS extern int32_t sched_run_interval; |