[tor-commits] [tor/maint-0.2.5] Merge branch 'maint-0.2.4' into maint-0.2.5

nickm at torproject.org nickm at torproject.org
Tue Feb 7 15:40:16 UTC 2017


commit c056d19323e499a0003ba9de0db2bdee9c301872
Merge: b9ef21c 85a2487
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Feb 7 10:37:31 2017 -0500

    Merge branch 'maint-0.2.4' into maint-0.2.5

 changes/bug16248 |  8 ++++++++
 src/or/main.c    | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 59 insertions(+), 4 deletions(-)

diff --cc src/or/main.c
index 031f758,9e78ea0..31fbdcd
--- a/src/or/main.c
+++ b/src/or/main.c
@@@ -524,9 -506,48 +524,48 @@@ connection_is_reading(connection_t *con
      (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;
+   }
+ 
+   if (bad) {
+     log_warn(LD_BUG, "Event missing on connection %p [%s;%s]. "
+              "socket=%d. linked=%d. "
+              "is_dns_request=%d. Marked_for_close=%s:%d",
+              conn,
+              conn_type_to_string(conn->type),
+              conn_state_to_string(conn->type, conn->state),
+              (int)conn->s, (int)conn->linked,
+              (conn->type == CONN_TYPE_AP && TO_EDGE_CONN(conn)->is_dns_request),
+              conn->marked_for_close_file ? conn->marked_for_close_file : "-",
+              conn->marked_for_close
+              );
+     //log_backtrace(LOG_WARN, LD_BUG, "Backtrace attached.");
+     return -1;
+   }
+   return 0;
+ }
+ 
  /** Tell the main loop to stop notifying <b>conn</b> of any read events. */
 -void
 -connection_stop_reading(connection_t *conn)
 +MOCK_IMPL(void,
 +connection_stop_reading,(connection_t *conn))
  {
    tor_assert(conn);
  





More information about the tor-commits mailing list