summaryrefslogtreecommitdiff
path: root/src/or/connection.h
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2016-08-20 03:34:16 +0000
committerAndrea Shepard <andrea@torproject.org>2016-08-20 03:34:16 +0000
commit1a7709d40949b559a6f86e2bbcd1648eeeeed1af (patch)
tree9e75a42d1d6aab1c917acdac5b0e7e2d95fd0779 /src/or/connection.h
parenta403230fe38d396189a32bc525aa596444d88b61 (diff)
downloadtor-1a7709d40949b559a6f86e2bbcd1648eeeeed1af.tar.gz
tor-1a7709d40949b559a6f86e2bbcd1648eeeeed1af.zip
Add connection_is_moribund() inline
Diffstat (limited to 'src/or/connection.h')
-rw-r--r--src/or/connection.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/or/connection.h b/src/or/connection.h
index 9bf063fbff..d25e002fa4 100644
--- a/src/or/connection.h
+++ b/src/or/connection.h
@@ -247,6 +247,20 @@ void clock_skew_warning(const connection_t *conn, long apparent_skew,
int trusted, log_domain_mask_t domain,
const char *received, const char *source);
+/** Check if a connection is on the way out so the OOS handler doesn't try
+ * to kill more than it needs. */
+static inline int
+connection_is_moribund(connection_t *conn)
+{
+ if (conn != NULL &&
+ (conn->conn_array_index < 0 ||
+ conn->marked_for_close)) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
void connection_check_oos(int n_socks, int failed);
#ifdef CONNECTION_PRIVATE