summaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-12-23 19:15:22 +0000
committerNick Mathewson <nickm@torproject.org>2007-12-23 19:15:22 +0000
commitda06bfb80fdb0f356cd5cf5746c06492afec0f78 (patch)
treed3cffd2f267f30d269bd1ffa223345fb2a817965 /src/or/circuitlist.c
parent473725e1a47c65b59dc22d974c0d7dd2d7f7c44c (diff)
downloadtor-da06bfb80fdb0f356cd5cf5746c06492afec0f78.tar.gz
tor-da06bfb80fdb0f356cd5cf5746c06492afec0f78.zip
r15653@tombo: nickm | 2007-12-23 14:15:12 -0500
Refactor circuit_launch* functions to take a bitfield of flags rather than 4 separate nonconsecutive flags arguments. Also, note a possible but in circuit_find_to_cannibalize, which seems to be ignoring its purpose argument. svn:r12948
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 375156b4e3..8eb442df84 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -791,19 +791,24 @@ circuit_get_intro_point(const char *digest)
}
/** Return a circuit that is open, is CIRCUIT_PURPOSE_C_GENERAL,
- * has a timestamp_dirty value of 0, is uptime/capacity/internal
- * if required, and if info is defined, does not already use info
+ * has a timestamp_dirty value of 0, has flags matching the CIRCLAUNCH_*
+ * flags in <b>flags</b>, and if info is defined, does not already use info
* as any of its hops; or NULL if no circuit fits this description.
*
- * If ! need_uptime, prefer returning non-uptime circuits.
+ * If !CIRCLAUNCH_NEED_UPTIME, prefer returning non-uptime circuits.
*/
origin_circuit_t *
circuit_find_to_cannibalize(uint8_t purpose, extend_info_t *info,
- int need_uptime,
- int need_capacity, int internal)
+ int flags)
{
+ /*XXXX020 arma: The purpose argument is ignored. Can that possibly be
+ * right? */
+
circuit_t *_circ;
origin_circuit_t *best=NULL;
+ int need_uptime = flags & CIRCLAUNCH_NEED_UPTIME;
+ int need_capacity = flags & CIRCLAUNCH_NEED_CAPACITY;
+ int internal = flags & CIRCLAUNCH_IS_INTERNAL;
log_debug(LD_CIRC,
"Hunting for a circ to cannibalize: purpose %d, uptime %d, "