[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r14413: Apply patch from mwenge to fix bug 646: makes stream events (in tor/trunk: . src/or)



Author: nickm
Date: 2008-04-22 13:21:12 -0400 (Tue, 22 Apr 2008)
New Revision: 14413

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/connection_edge.c
Log:
 r15278@tombo:  nickm | 2008-04-22 13:17:37 -0400
 Apply patch from mwenge to fix bug 646: makes stream events for dns requests get generated more consistently.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15278] on 49666b30-7950-49c5-bedf-9dc8f3168102

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-04-22 17:21:09 UTC (rev 14412)
+++ tor/trunk/ChangeLog	2008-04-22 17:21:12 UTC (rev 14413)
@@ -31,6 +31,10 @@
       untrusted sources.  Fixes bug 663.
     - Non-exit relays no longer allow DNS requests.  Fixes bug 619.
       Patch from Lodger.
+    - Make controller stream events for DNS requests more consistent,
+      by adding "new stream" events for DNS requests, and removing
+      spurious "stream closed" events" for cached reverse resolves.
+      Patch from mwenge.  Fixes bug 646.
 
   o Minor features:
     - Allow separate log levels to be configured for different logging

Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2008-04-22 17:21:09 UTC (rev 14412)
+++ tor/trunk/src/or/connection_edge.c	2008-04-22 17:21:12 UTC (rev 14413)
@@ -1348,13 +1348,15 @@
                                    &map_expires)) {
       char *result = tor_strdup(socks->address);
       /* remember _what_ is supposed to have been resolved. */
-      strlcpy(socks->address, orig_address, sizeof(socks->address));
+      tor_snprintf(socks->address, sizeof(socks->address), "REVERSE[%s]",
+                  orig_address);
       connection_ap_handshake_socks_resolved(conn, RESOLVED_TYPE_HOSTNAME,
                                              strlen(result), result, -1,
                                              map_expires);
       connection_mark_unattached_ap(conn,
-                                 END_STREAM_REASON_DONE |
-                                 END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED);
+                                END_STREAM_REASON_DONE |
+                                END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED |
+                                END_STREAM_REASON_FLAG_ALREADY_SENT_CLOSED);
       return 0;
     }
     if (options->ClientDNSRejectInternalAddresses) {
@@ -2084,9 +2086,11 @@
                            string_addr, payload_len) < 0)
     return -1; /* circuit is closed, don't continue */
 
+  ap_conn->_base.address = tor_strdup("(Tor_internal)");
   ap_conn->_base.state = AP_CONN_STATE_RESOLVE_WAIT;
   log_info(LD_APP,"Address sent for resolve, ap socket %d, n_circ_id %d",
            ap_conn->_base.s, circ->_base.n_circ_id);
+  control_event_stream_status(ap_conn, STREAM_EVENT_NEW, 0);
   control_event_stream_status(ap_conn, STREAM_EVENT_SENT_RESOLVE, 0);
   return 0;
 }