[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Add comments to connection_check_event().
commit 307b863556e34f0f1575c8c7ea1dd79e07eff16c
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Mon Mar 14 12:53:21 2016 -0400
Add comments to connection_check_event().
---
src/or/main.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/or/main.c b/src/or/main.c
index f91049b..f17fc90 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;
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits