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");
if(circuit_get_by_aci_conn(test_aci, conn))
goto try_again;
+#endif
return test_aci;
}
#include "orconfig.h"
#define USE_TLS
+#define SEQUENTIAL_ACI
#include <stdio.h>
#include <stdlib.h>
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: */
char stream_id[STREAM_ID_SIZE];