diff options
author | Andrea Shepard <andrea@torproject.org> | 2016-07-02 04:39:45 +0000 |
---|---|---|
committer | Andrea Shepard <andrea@torproject.org> | 2016-08-20 01:43:51 +0000 |
commit | 26c2ded00cfcf1c86ebe10a65b6de0af0e5b76c7 (patch) | |
tree | a110fe894622639b882a836914e4845c5fee9e53 /src/or | |
parent | 709f2cbf58c0acc4c84035dadc6be4846b5d3f3e (diff) | |
download | tor-26c2ded00cfcf1c86ebe10a65b6de0af0e5b76c7.tar.gz tor-26c2ded00cfcf1c86ebe10a65b6de0af0e5b76c7.zip |
Unit test for connection_handle_oos()
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/connection.c | 8 | ||||
-rw-r--r-- | src/or/connection.h | 3 | ||||
-rw-r--r-- | src/or/main.c | 4 | ||||
-rw-r--r-- | src/or/main.h | 2 |
4 files changed, 10 insertions, 7 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 9c80d97e4d..844ab40b6e 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -4550,8 +4550,8 @@ oos_victim_comparator(const void **a_v, const void **b_v) /** Pick n victim connections for the OOS handler and return them in a * smartlist. */ -static smartlist_t * -pick_oos_victims(int n) +MOCK_IMPL(STATIC smartlist_t *, +pick_oos_victims, (int n)) { smartlist_t *eligible = NULL, *victims = NULL; smartlist_t *conns; @@ -4639,8 +4639,8 @@ pick_oos_victims(int n) } /** Kill a list of connections for the OOS handler. */ -static void -kill_conn_list_for_oos(smartlist_t *conns) +MOCK_IMPL(STATIC void, +kill_conn_list_for_oos, (smartlist_t *conns)) { if (!conns) return; diff --git a/src/or/connection.h b/src/or/connection.h index 4e8a740601..83ee76932b 100644 --- a/src/or/connection.h +++ b/src/or/connection.h @@ -267,6 +267,9 @@ MOCK_DECL(STATIC int,connection_connect_sockaddr, const struct sockaddr *bindaddr, socklen_t bindaddr_len, int *socket_error)); +MOCK_DECL(STATIC void, kill_conn_list_for_oos, (smartlist_t *conns)); +MOCK_DECL(STATIC smartlist_t *, pick_oos_victims, (int n)); + #endif #endif diff --git a/src/or/main.c b/src/or/main.c index 30041c5e2b..7f00cc3455 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -652,8 +652,8 @@ close_closeable_connections(void) } /** Count moribund connections for the OOS handler */ -int -connection_count_moribund(void) +MOCK_IMPL(int, +connection_count_moribund, (void)) { int i, moribund = 0; connection_t *conn; diff --git a/src/or/main.h b/src/or/main.h index 4f58f170d5..45c3b3ff78 100644 --- a/src/or/main.h +++ b/src/or/main.h @@ -47,7 +47,7 @@ MOCK_DECL(void,connection_start_writing,(connection_t *conn)); void connection_stop_reading_from_linked_conn(connection_t *conn); -int connection_count_moribund(void); +MOCK_DECL(int, connection_count_moribund, (void)); void directory_all_unreachable(time_t now); void directory_info_has_arrived(time_t now, int from_cache, int suppress_logs); |