summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-08-25 14:29:06 -0400
committerNick Mathewson <nickm@torproject.org>2016-08-25 14:29:06 -0400
commit1dfa2213a424c36d4aa70fdab60b27b6b5e1ced2 (patch)
treeb53afb27b4ab30c2913ac5e4fba69e8f319fdbc7 /src/or/main.c
parent20136a8207f0cda0d23093a884caae0358f98bac (diff)
parent9a09513c0bd54abae3317be4136cf2578e11fbf3 (diff)
downloadtor-1dfa2213a424c36d4aa70fdab60b27b6b5e1ced2.tar.gz
tor-1dfa2213a424c36d4aa70fdab60b27b6b5e1ced2.zip
Merge remote-tracking branch 'andrea/ticket18640_v3'
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 4dbd9a005b..03c2b7ed58 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -381,8 +381,8 @@ connection_in_array(connection_t *conn)
/** Set <b>*array</b> to an array of all connections. <b>*array</b> must not
* be modified.
*/
-smartlist_t *
-get_connection_array(void)
+MOCK_IMPL(smartlist_t *,
+get_connection_array, (void))
{
if (!connection_array)
connection_array = smartlist_new();
@@ -651,6 +651,23 @@ close_closeable_connections(void)
}
}
+/** Count moribund connections for the OOS handler */
+MOCK_IMPL(int,
+connection_count_moribund, (void))
+{
+ int moribund = 0;
+
+ /*
+ * Count things we'll try to kill when close_closeable_connections()
+ * runs next.
+ */
+ SMARTLIST_FOREACH_BEGIN(closeable_connection_lst, connection_t *, conn) {
+ if (SOCKET_OK(conn->s) && connection_is_moribund(conn)) ++moribund;
+ } SMARTLIST_FOREACH_END(conn);
+
+ return moribund;
+}
+
/** Libevent callback: this gets invoked when (connection_t*)<b>conn</b> has
* some data to read. */
static void