summaryrefslogtreecommitdiff
path: root/src/or/connection.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-01 13:43:11 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-01 15:20:37 -0400
commit6da0311d2cc71d6d0732c8432eea38cd1819aa86 (patch)
tree98ce8cdfc60f6bf4c57885b0f1fe43369d15b492 /src/or/connection.h
parent1743dac078f2e060f3f6c7194deae90a2175fe92 (diff)
downloadtor-6da0311d2cc71d6d0732c8432eea38cd1819aa86.tar.gz
tor-6da0311d2cc71d6d0732c8432eea38cd1819aa86.zip
Extract various enums and tiny structs from or.h
These all have a logical header to go in.
Diffstat (limited to 'src/or/connection.h')
-rw-r--r--src/or/connection.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/or/connection.h b/src/or/connection.h
index 75198ed067..0b4a35cc5c 100644
--- a/src/or/connection.h
+++ b/src/or/connection.h
@@ -241,6 +241,24 @@ MOCK_DECL(void, clock_skew_warning,
int connection_is_moribund(connection_t *conn);
void connection_check_oos(int n_socks, int failed);
+/** Execute the statement <b>stmt</b>, which may log events concerning the
+ * connection <b>conn</b>. To prevent infinite loops, disable log messages
+ * being sent to controllers if <b>conn</b> is a control connection.
+ *
+ * Stmt must not contain any return or goto statements.
+ */
+#define CONN_LOG_PROTECT(conn, stmt) \
+ STMT_BEGIN \
+ int _log_conn_is_control; \
+ tor_assert(conn); \
+ _log_conn_is_control = (conn->type == CONN_TYPE_CONTROL); \
+ if (_log_conn_is_control) \
+ disable_control_logging(); \
+ STMT_BEGIN stmt; STMT_END; \
+ if (_log_conn_is_control) \
+ enable_control_logging(); \
+ STMT_END
+
#ifdef CONNECTION_PRIVATE
STATIC void connection_free_minimal(connection_t *conn);