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

[or-cvs] Add #ifdef"d code (on by default) to allocate ACIs sequenti...



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

Modified Files:
	circuit.c or.h 
Log Message:
Add #ifdef'd code (on by default) to allocate ACIs sequentially.



Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- circuit.c	16 Sep 2003 05:41:49 -0000	1.61
+++ circuit.c	16 Sep 2003 17:17:39 -0000	1.62
@@ -122,6 +122,19 @@
   aci_t test_aci;
   connection_t *conn;
 
+#ifdef SEQUENTIAL_ACI
+  /* Right now, this is the only used aci_type.  XXX The others should
+     be removed. */
+  assert(aci_type == ACI_TYPE_BOTH); 
+  conn = connection_exact_get_by_addr_port(addr,port);
+  if (!conn)
+    return 1; /* No connection exists; conflict is impossible. */
+  do {
+    test_aci = conn->next_aci++; /* This can wrap around to 0; that's okay. */
+    if (test_aci == 0)
+      continue;
+  } while(circuit_get_by_aci_conn(test_aci, conn));
+#else
 try_again:
   log_fn(LOG_DEBUG,"trying to get a unique aci");
 
@@ -143,6 +156,7 @@
 
   if(circuit_get_by_aci_conn(test_aci, conn))
     goto try_again;
+#endif
 
   return test_aci;
 }

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- or.h	16 Sep 2003 05:41:49 -0000	1.126
+++ or.h	16 Sep 2003 17:17:39 -0000	1.127
@@ -8,6 +8,7 @@
 #include "orconfig.h"
 
 #define USE_TLS
+#define SEQUENTIAL_ACI
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -313,6 +314,9 @@
   crypto_cipher_env_t *b_crypto;
 
   char nonce[8];
+#endif
+#ifdef SEQUENTIAL_ACI
+  uint16_t next_aci; /* Which ACI do we try to use next on this connection? */
 #endif
 
 /* Used only by edge connections: */