diff options
author | Andrea Shepard <andrea@torproject.org> | 2016-08-20 03:34:16 +0000 |
---|---|---|
committer | Andrea Shepard <andrea@torproject.org> | 2016-08-20 03:34:16 +0000 |
commit | 1a7709d40949b559a6f86e2bbcd1648eeeeed1af (patch) | |
tree | 9e75a42d1d6aab1c917acdac5b0e7e2d95fd0779 /src/or/connection.h | |
parent | a403230fe38d396189a32bc525aa596444d88b61 (diff) | |
download | tor-1a7709d40949b559a6f86e2bbcd1648eeeeed1af.tar.gz tor-1a7709d40949b559a6f86e2bbcd1648eeeeed1af.zip |
Add connection_is_moribund() inline
Diffstat (limited to 'src/or/connection.h')
-rw-r--r-- | src/or/connection.h | 14 |
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 |