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

[or-cvs] r8699: Second patch to work on circuit close reasons from Mike Perr (in tor/trunk: . src/or)



Author: nickm
Date: 2006-10-13 01:27:59 -0400 (Fri, 13 Oct 2006)
New Revision: 8699

Modified:
   tor/trunk/
   tor/trunk/src/or/command.c
   tor/trunk/src/or/control.c
   tor/trunk/src/or/relay.c
Log:
 r9017@totoro:  nickm | 2006-10-13 01:27:33 -0400
 Second patch to work on circuit close reasons from Mike Perry.  Disabled partially; see comment.  Whitespace cleaned up.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r9017] on 96637b51-b116-0410-a10e-9941ebb49b64

Modified: tor/trunk/src/or/command.c
===================================================================
--- tor/trunk/src/or/command.c	2006-10-13 05:00:41 UTC (rev 8698)
+++ tor/trunk/src/or/command.c	2006-10-13 05:27:59 UTC (rev 8699)
@@ -378,6 +378,19 @@
   } else { /* the destroy came from ahead */
     circuit_set_n_circid_orconn(circ, 0, NULL);
     if (CIRCUIT_IS_ORIGIN(circ)) {
+      /* Prevent arbitrary destroys from going unnoticed by controller */
+      /* XXXX Not quite right; what we want is to tell the controller the
+       *      exact reason that we were asked to close, but tell it that we
+       *      closed because we were asked. Anything else is not accurate.
+       *      OR_CONN_CLOSED is certainly wrong, since a destroy doesn't mean
+       *      that the underlying OR connection got closed. -NM */
+#if 0
+      if (reason == END_CIRC_AT_ORIGIN ||
+          reason == END_CIRC_REASON_NONE ||
+          reason == END_CIRC_REASON_REQUESTED) {
+        reason = END_CIRC_REASON_OR_CONN_CLOSED;
+      }
+#endif
       circuit_mark_for_close(circ, reason);
     } else {
       char payload[1];

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2006-10-13 05:00:41 UTC (rev 8698)
+++ tor/trunk/src/or/control.c	2006-10-13 05:27:59 UTC (rev 8699)
@@ -2370,7 +2370,7 @@
   }
 
   if (!safe || !circ->p_streams) {
-    circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_NONE);
+    circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_REQUESTED);
   }
 
   send_control_done(conn);
@@ -2990,7 +2990,7 @@
       name[0] = '$';
       base16_encode(name+1, len-1, conn->identity_digest,
                     DIGEST_LEN);
-    } else { 
+    } else {
      tor_snprintf(name, len, "%s:%d",
                    conn->_base.address, conn->_base.port);
     }

Modified: tor/trunk/src/or/relay.c
===================================================================
--- tor/trunk/src/or/relay.c	2006-10-13 05:00:41 UTC (rev 8698)
+++ tor/trunk/src/or/relay.c	2006-10-13 05:27:59 UTC (rev 8699)
@@ -158,7 +158,7 @@
 
   if (relay_crypt(circ, cell, cell_direction, &layer_hint, &recognized) < 0) {
     log_warn(LD_BUG,"relay crypt failed. Dropping connection.");
-    return -1;
+    return -END_CIRC_REASON_INTERNAL;
   }
 
   if (recognized) {