summaryrefslogtreecommitdiff
path: root/src/or/routerset.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-29 10:14:42 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-16 11:06:18 -0500
commit53f248f6c9d71784c271cf14501ec4c28e5e885d (patch)
tree75b16a87ae378b930796e631bf1f0f01ac8c55e8 /src/or/routerset.c
parent1d52ac4d3f67a6e3fac3602f87d00c14060068ab (diff)
downloadtor-53f248f6c9d71784c271cf14501ec4c28e5e885d.tar.gz
tor-53f248f6c9d71784c271cf14501ec4c28e5e885d.zip
Add some needed accessors/inspectors for bridge/guard convergence
Diffstat (limited to 'src/or/routerset.c')
-rw-r--r--src/or/routerset.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/routerset.c b/src/or/routerset.c
index 4182dbc5c4..d0df0a74e6 100644
--- a/src/or/routerset.c
+++ b/src/or/routerset.c
@@ -28,6 +28,7 @@
#define ROUTERSET_PRIVATE
#include "or.h"
+#include "bridges.h"
#include "geoip.h"
#include "nodelist.h"
#include "policies.h"
@@ -334,6 +335,18 @@ routerset_contains_node(const routerset_t *set, const node_t *node)
return 0;
}
+/** Return true iff <b>routerset</b> contains the bridge <b>bridge</b>. */
+int
+routerset_contains_bridge(const routerset_t *set, const bridge_info_t *bridge)
+{
+ const char *id = (const char*)bridge_get_rsa_id_digest(bridge);
+ const tor_addr_port_t *addrport = bridge_get_addr_port(bridge);
+
+ tor_assert(addrport);
+ return routerset_contains(set, &addrport->addr, addrport->port,
+ NULL, id, -1);
+}
+
/** Add every known node_t that is a member of <b>routerset</b> to
* <b>out</b>, but never add any that are part of <b>excludeset</b>.
* If <b>running_only</b>, only add the running ones. */