[tor-commits] [tor/master] Implement kill_conn_list_for_oos()

nickm at torproject.org nickm at torproject.org
Thu Aug 25 18:32:16 UTC 2016


commit e9464737af4b31e0aba29eb5581a5faf80647800
Author: Andrea Shepard <andrea at torproject.org>
Date:   Thu Jun 30 14:13:42 2016 +0000

    Implement kill_conn_list_for_oos()
---
 src/or/connection.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/or/connection.c b/src/or/connection.c
index fce63ad..e164fae 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -4519,9 +4519,20 @@ pick_oos_victims(int n)
 static void
 kill_conn_list_for_oos(smartlist_t *conns)
 {
-  (void)conns;
+  if (!conns) return;
 
-  /* TODO */
+  SMARTLIST_FOREACH_BEGIN(conns, connection_t *, c) {
+    /* Make sure the channel layer gets told about orconns */
+    if (c->type == CONN_TYPE_OR) {
+      connection_or_close_for_error(TO_OR_CONN(c), 1);
+    } else {
+      connection_mark_and_flush(c);
+    }
+  } SMARTLIST_FOREACH_END(c);
+
+  log_notice(LD_NET,
+             "OOS handler marked and flushed %d connections",
+             smartlist_len(conns));
 }
 
 /** Out-of-Sockets handler; n_socks is the current number of open





More information about the tor-commits mailing list