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

[or-cvs] check for duplicate circuit ID _after_ updating circ_id_type.



Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv4608/src/or

Modified Files:
	command.c 
Log Message:
check for duplicate circuit ID _after_ updating circ_id_type.

Index: command.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/command.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- command.c	29 Nov 2004 22:25:29 -0000	1.77
+++ command.c	1 Dec 2004 04:55:03 -0000	1.78
@@ -137,13 +137,6 @@
     return;
   }
 
-  circ = circuit_get_by_circ_id_conn(cell->circ_id, conn);
-
-  if (circ) {
-    log_fn(LOG_WARN,"received CREATE cell (circID %d) for known circ. Dropping.", cell->circ_id);
-    return;
-  }
-
   /* If the high bit of the circuit ID is not as expected, then switch
    * which half of the space we'll use for our own CREATE cells.
    *
@@ -160,6 +153,13 @@
     conn->circ_id_type = CIRC_ID_TYPE_HIGHER;
   }
 
+  circ = circuit_get_by_circ_id_conn(cell->circ_id, conn);
+
+  if (circ) {
+    log_fn(LOG_WARN,"received CREATE cell (circID %d) for known circ. Dropping.", cell->circ_id);
+    return;
+  }
+
   circ = circuit_new(cell->circ_id, conn);
   circ->state = CIRCUIT_STATE_ONIONSKIN_PENDING;
   circ->purpose = CIRCUIT_PURPOSE_OR;