diff options
author | Andrea Shepard <andrea@torproject.org> | 2016-08-20 03:57:32 +0000 |
---|---|---|
committer | Andrea Shepard <andrea@torproject.org> | 2016-08-20 03:57:32 +0000 |
commit | 3efe92ba58137022dd6c61cff9823813218a1a14 (patch) | |
tree | 74f4febb3370c643eeeda484c696335be2c3e329 /src | |
parent | 1a7709d40949b559a6f86e2bbcd1648eeeeed1af (diff) | |
download | tor-3efe92ba58137022dd6c61cff9823813218a1a14.tar.gz tor-3efe92ba58137022dd6c61cff9823813218a1a14.zip |
Consider the case that a connection doesn't have a valid socket during OOS
Diffstat (limited to 'src')
-rw-r--r-- | src/or/connection.c | 5 | ||||
-rw-r--r-- | src/or/main.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 713a70cca4..6b85bfb550 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -4587,6 +4587,11 @@ pick_oos_victims, (int n)) tor_assert(c->type <= CONN_TYPE_MAX_); ++(conn_counts_by_type[c->type]); + /* Skip anything without a socket we can free */ + if (!(SOCKET_OK(c->s))) { + continue; + } + /* Skip anything we would count as moribund */ if (connection_is_moribund(c)) { continue; diff --git a/src/or/main.c b/src/or/main.c index 6ab94f5e36..a1b5954aaf 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -662,7 +662,7 @@ connection_count_moribund, (void)) * runs next. */ SMARTLIST_FOREACH_BEGIN(closeable_connection_lst, connection_t *, conn) { - if (connection_is_moribund(conn)) ++moribund; + if (SOCKET_OK(conn->s) && connection_is_moribund(conn)) ++moribund; } SMARTLIST_FOREACH_END(conn); return moribund; |