diff options
author | Taylor Yu <catalyst@torproject.org> | 2019-03-28 17:45:49 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2019-06-11 11:59:30 -0400 |
commit | 0bce0c339d5f4c6ddeb90c21502a9716fb6cd17a (patch) | |
tree | b578ef01c6480ac9bb1eca3fd239e6fd79dd53ed /src/test/test_btrack.c | |
parent | a8c0f4ddfe3f0a63bd499959c8d921346aa9766e (diff) | |
download | tor-0bce0c339d5f4c6ddeb90c21502a9716fb6cd17a.tar.gz tor-0bce0c339d5f4c6ddeb90c21502a9716fb6cd17a.zip |
Rework origin circuit tracking to use pubsub
Part of ticket 29976.
Diffstat (limited to 'src/test/test_btrack.c')
-rw-r--r-- | src/test/test_btrack.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/test/test_btrack.c b/src/test/test_btrack.c index fef1da4842..9e5d0d0723 100644 --- a/src/test/test_btrack.c +++ b/src/test/test_btrack.c @@ -31,10 +31,19 @@ send_status(const orconn_status_msg_t *msg_in) } static void +send_chan(const ocirc_chan_msg_t *msg_in) +{ + ocirc_chan_msg_t *msg = tor_malloc(sizeof(*msg)); + + *msg = *msg_in; + ocirc_chan_publish(msg); +} + +static void test_btrack_launch(void *arg) { orconn_state_msg_t conn; - ocirc_event_msg_t circ; + ocirc_chan_msg_t circ; (void)arg; conn.gid = 1; @@ -48,12 +57,11 @@ test_btrack_launch(void *arg) expect_no_log_msg_containing("ORCONN BEST_"); teardown_capture_of_logs(); - circ.type = OCIRC_MSGTYPE_CHAN; - circ.u.chan.chan = 1; - circ.u.chan.onehop = true; + circ.chan = 1; + circ.onehop = true; setup_full_capture_of_logs(LOG_DEBUG); - ocirc_event_publish(&circ); + send_chan(&circ); expect_log_msg_containing("ORCONN LAUNCH chan=1 onehop=1"); expect_log_msg_containing("ORCONN BEST_ANY state -1->1 gid=1"); teardown_capture_of_logs(); @@ -67,11 +75,11 @@ test_btrack_launch(void *arg) expect_no_log_msg_containing("ORCONN BEST_"); teardown_capture_of_logs(); - circ.u.chan.chan = 2; - circ.u.chan.onehop = false; + circ.chan = 2; + circ.onehop = false; setup_full_capture_of_logs(LOG_DEBUG); - ocirc_event_publish(&circ); + send_chan(&circ); expect_log_msg_containing("ORCONN LAUNCH chan=2 onehop=0"); expect_log_msg_containing("ORCONN BEST_AP state -1->1 gid=2"); teardown_capture_of_logs(); |