aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-03-14 12:53:21 -0400
committerNick Mathewson <nickm@torproject.org>2017-02-07 09:48:24 -0500
commitcfeb1db2fb881db85a11d80e70a1a14c62b46950 (patch)
tree3fd5119e4a4a54dabf60e27259b55362b254dec4
parent457d38a6e9212de3a5cab24fc59829c689f88560 (diff)
downloadtor-cfeb1db2fb881db85a11d80e70a1a14c62b46950.tar.gz
tor-cfeb1db2fb881db85a11d80e70a1a14c62b46950.zip
Add comments to connection_check_event().
-rw-r--r--src/or/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 1200b55e2e..89e5a512b3 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -506,14 +506,24 @@ connection_is_reading(connection_t *conn)
(conn->read_event && event_pending(conn->read_event, EV_READ, NULL));
}
+/** Check whether <b>conn</b> is correct in having (or not having) a
+ * read/write event (passed in <b>ev</b). On success, return 0. On failure,
+ * log a warning and return -1. */
static int
connection_check_event(connection_t *conn, struct event *ev)
{
int bad;
if (conn->type == CONN_TYPE_AP && TO_EDGE_CONN(conn)->is_dns_request) {
+ /* DNS requests which we launch through the dnsserv.c module do not have
+ * any underlying socket or any underlying linked connection, so they
+ * shouldn't have any attached events either.
+ */
bad = ev != NULL;
} else {
+ /* Everytyhing else should have an underlying socket, or a linked
+ * connection (which is also tracked with a read_event/write_event pair).
+ */
bad = ev == NULL;
}