aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-03-14 12:53:21 -0400
committerNick Mathewson <nickm@torproject.org>2016-03-14 12:53:21 -0400
commit307b863556e34f0f1575c8c7ea1dd79e07eff16c (patch)
tree38c27c0fa7b0696fa5bf410a3f3b7fa6591cb85d /src/or
parent91d7cf50c6cb6eb1e2dc2b4a8eab489c10a759a6 (diff)
downloadtor-307b863556e34f0f1575c8c7ea1dd79e07eff16c.tar.gz
tor-307b863556e34f0f1575c8c7ea1dd79e07eff16c.zip
Add comments to connection_check_event().
Diffstat (limited to 'src/or')
-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 f91049b80f..f17fc901c3 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -567,14 +567,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;
}