aboutsummaryrefslogtreecommitdiff
path: root/src/lib/pubsub
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2019-06-11 11:59:39 -0400
committerDavid Goulet <dgoulet@torproject.org>2019-06-11 11:59:39 -0400
commitf7e8b3b68c8e2cecfc7ff4072e9f00d316aaba4f (patch)
treeddd7cd4b63c03d0c35b7e9063b8e40ea2bb065d6 /src/lib/pubsub
parent8e112cecd8cf944e095304257563415e60891780 (diff)
parent5f5f6bb8fb68d171a39eb1e5c6e6649087ec551d (diff)
downloadtor-f7e8b3b68c8e2cecfc7ff4072e9f00d316aaba4f.tar.gz
tor-f7e8b3b68c8e2cecfc7ff4072e9f00d316aaba4f.zip
Merge branch 'tor-github/pr/1040'
Diffstat (limited to 'src/lib/pubsub')
-rw-r--r--src/lib/pubsub/pubsub_check.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/lib/pubsub/pubsub_check.c b/src/lib/pubsub/pubsub_check.c
index a3c22d4f25..bf1196df2c 100644
--- a/src/lib/pubsub/pubsub_check.c
+++ b/src/lib/pubsub/pubsub_check.c
@@ -172,34 +172,20 @@ pubsub_cfg_dump(const pubsub_cfg_t *cfg, int severity, const char *prefix)
/**
* Helper: fill a bitarray <b>out</b> with entries corresponding to the
- * subsystems listed in <b>items</b>. If any subsystem is listed more than
- * once, log a warning. Return 0 on success, -1 on failure.
+ * subsystems listed in <b>items</b>.
**/
-static int
+static void
get_message_bitarray(const pubsub_adjmap_t *map,
- message_id_t msg,
const smartlist_t *items,
- const char *operation,
bitarray_t **out)
{
- bool ok = true;
*out = bitarray_init_zero((unsigned)map->n_subsystems);
if (! items)
- return 0;
+ return;
SMARTLIST_FOREACH_BEGIN(items, const pubsub_cfg_t *, cfg) {
- if (bitarray_is_set(*out, cfg->subsys)) {
- log_warn(LD_MESG|LD_BUG,
- "Message \"%s\" is configured to be %s by subsystem "
- "\"%s\" more than once.",
- get_message_id_name(msg), operation,
- get_subsys_id_name(cfg->subsys));
- ok = false;
- }
bitarray_set(*out, cfg->subsys);
} SMARTLIST_FOREACH_END(cfg);
-
- return ok ? 0 : -1;
}
/**
@@ -222,10 +208,8 @@ lint_message_graph(const pubsub_adjmap_t *map,
bitarray_t *subscribed_by = NULL;
bool ok = true;
- if (get_message_bitarray(map, msg, pub, "published", &published_by) < 0)
- ok = false;
- if (get_message_bitarray(map, msg, sub, "subscribed", &subscribed_by) < 0)
- ok = false;
+ get_message_bitarray(map, pub, &published_by);
+ get_message_bitarray(map, sub, &subscribed_by);
/* Check whether any subsystem is publishing and subscribing the same
* message. [??]