Browse Source

r17308@aud-055: nickm | 2008-07-23 15:57:41 +0200
In connection_edge_destroy, send a stream status control event when we have an AP connection. Previously, we would send an event when the connection was AP and non-AP at the same time. This didn't work so well. Patch from Anonymous Remailer (Austria). Backport candidate.


svn:r16143

Nick Mathewson 17 years ago
parent
commit
cc46b23248
2 changed files with 8 additions and 3 deletions
  1. 5 0
      ChangeLog
  2. 3 3
      src/or/connection_edge.c

+ 5 - 0
ChangeLog

@@ -39,6 +39,11 @@ Changes in version 0.2.1.3-alpha - 2008-07-xx
       don't reschedule publication of the next descriptor. Fixes bug 763.
       don't reschedule publication of the next descriptor. Fixes bug 763.
       Bugfix on 0.0.9.3.
       Bugfix on 0.0.9.3.
 
 
+  o Minor bugfixes (controller):
+    - When closing an application-side connection because its circuit
+      is getting torn down, generate the stream event correctly.
+      Bugfix on 0.1.2.x.  Anonymous patch.
+
   o Removed features
   o Removed features
     - Remove all backward-compatibility code to support servers running
     - Remove all backward-compatibility code to support servers running
       versions of Tor so old as to no longer work at all on the Tor network.
       versions of Tor so old as to no longer work at all on the Tor network.

+ 3 - 3
src/or/connection_edge.c

@@ -160,14 +160,14 @@ connection_edge_destroy(uint16_t circ_id, edge_connection_t *conn)
              "CircID %d: At an edge. Marking connection for close.", circ_id);
              "CircID %d: At an edge. Marking connection for close.", circ_id);
     if (conn->_base.type == CONN_TYPE_AP) {
     if (conn->_base.type == CONN_TYPE_AP) {
       connection_mark_unattached_ap(conn, END_STREAM_REASON_DESTROY);
       connection_mark_unattached_ap(conn, END_STREAM_REASON_DESTROY);
+      control_event_stream_status(conn, STREAM_EVENT_CLOSED,
+                                  END_STREAM_REASON_DESTROY);
+      conn->end_reason |= END_STREAM_REASON_FLAG_ALREADY_SENT_CLOSED;
     } else {
     } else {
       /* closing the circuit, nothing to send an END to */
       /* closing the circuit, nothing to send an END to */
       conn->_base.edge_has_sent_end = 1;
       conn->_base.edge_has_sent_end = 1;
       conn->end_reason = END_STREAM_REASON_DESTROY;
       conn->end_reason = END_STREAM_REASON_DESTROY;
       conn->end_reason |= END_STREAM_REASON_FLAG_ALREADY_SENT_CLOSED;
       conn->end_reason |= END_STREAM_REASON_FLAG_ALREADY_SENT_CLOSED;
-      if (conn->_base.type == CONN_TYPE_AP)
-        control_event_stream_status(conn, STREAM_EVENT_CLOSED,
-                                    END_STREAM_REASON_DESTROY);
       connection_mark_for_close(TO_CONN(conn));
       connection_mark_for_close(TO_CONN(conn));
       conn->_base.hold_open_until_flushed = 1;
       conn->_base.hold_open_until_flushed = 1;
     }
     }