diff options
author | David Goulet <dgoulet@torproject.org> | 2017-09-14 14:37:10 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-09-15 11:40:59 -0400 |
commit | e0984b8a51d2363d9ff30779d339d058887831ee (patch) | |
tree | 6a43b09d05e9e603611e8720550385807e662045 /src/or/scheduler_kist.c | |
parent | ba08f8a4ed2628bde685612f2dd4aa7c85bdac57 (diff) | |
download | tor-e0984b8a51d2363d9ff30779d339d058887831ee.tar.gz tor-e0984b8a51d2363d9ff30779d339d058887831ee.zip |
sched: Make the outbuf table local to run()
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/scheduler_kist.c')
-rw-r--r-- | src/or/scheduler_kist.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c index 85d0b2a1fc..aad29b6a62 100644 --- a/src/or/scheduler_kist.c +++ b/src/or/scheduler_kist.c @@ -85,8 +85,6 @@ outbuf_table_ent_eq(const outbuf_table_ent_t *a, const outbuf_table_ent_t *b) return a->chan->global_identifier == b->chan->global_identifier; } -static outbuf_table_t outbuf_table = HT_INITIALIZER(); - HT_PROTOTYPE(outbuf_table_s, outbuf_table_ent_s, node, outbuf_table_ent_hash, outbuf_table_ent_eq) HT_GENERATE2(outbuf_table_s, outbuf_table_ent_s, node, outbuf_table_ent_hash, @@ -145,13 +143,6 @@ free_outbuf_info_by_ent(outbuf_table_ent_t *ent, void *data) return 1; /* So HT_FOREACH_FN will remove the element */ } -/* Clean up outbuf_table. Probably because the KIST sched impl is going away */ -static void -free_all_outbuf_info(void) -{ - HT_FOREACH_FN(outbuf_table_s, &outbuf_table, free_outbuf_info_by_ent, NULL); -} - /* Free the given socket table entry ent. */ static int free_socket_info_by_ent(socket_table_ent_t *ent, void *data) @@ -425,7 +416,6 @@ have_work(void) static void kist_free_all(void) { - free_all_outbuf_info(); free_all_socket_info(); } @@ -508,6 +498,8 @@ kist_scheduler_run(void) smartlist_t *to_readd = NULL; smartlist_t *cp = get_channels_pending(); + outbuf_table_t outbuf_table = HT_INITIALIZER(); + /* For each pending channel, collect new kernel information */ SMARTLIST_FOREACH_BEGIN(cp, const channel_t *, pchan) { init_socket_info(&socket_table, pchan); @@ -618,7 +610,8 @@ kist_scheduler_run(void) /* Write the outbuf of any channels that still have data */ HT_FOREACH_FN(outbuf_table_s, &outbuf_table, each_channel_write_to_kernel, NULL); - free_all_outbuf_info(); + /* We are done with it. */ + HT_FOREACH_FN(outbuf_table_s, &outbuf_table, free_outbuf_info_by_ent, NULL); HT_CLEAR(outbuf_table_s, &outbuf_table); log_debug(LD_SCHED, "len pending=%d, len to_readd=%d", |