summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-control.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-05-20 00:21:56 +0200
committerLennart Poettering <lennart@poettering.net>2013-05-20 10:13:38 +0200
commit86312ab8de59c1066d6d2b456f3a9106ce3e0991 (patch)
tree39b64999a9eae57ad0e767496f5f0347776f4701 /src/libsystemd-bus/bus-control.c
parentc78196699d3d805b2237896a1d2b8efeec6068d0 (diff)
bus: add a more comprehensive test for the bloom filter logic
Diffstat (limited to 'src/libsystemd-bus/bus-control.c')
-rw-r--r--src/libsystemd-bus/bus-control.c47
1 files changed, 36 insertions, 11 deletions
diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c
index ae0d7f976..66f713082 100644
--- a/src/libsystemd-bus/bus-control.c
+++ b/src/libsystemd-bus/bus-control.c
@@ -385,12 +385,9 @@ int bus_add_match_internal(
break;
- case BUS_MATCH_DESTINATION:
- /* The bloom filter does not include
- the destination, since it is only
- available for broadcast messages
- which do not carry a destination
- since they are undirected. */
+ case BUS_MATCH_MESSAGE_TYPE:
+ bloom_add_pair(bloom, "message-type", bus_message_type_to_string(c->value_u8));
+ using_bloom = true;
break;
case BUS_MATCH_INTERFACE:
@@ -413,11 +410,39 @@ int bus_add_match_internal(
using_bloom = true;
break;
- case BUS_MATCH_ARG...BUS_MATCH_ARG_LAST:
- case BUS_MATCH_ARG_PATH...BUS_MATCH_ARG_PATH_LAST:
- case BUS_MATCH_ARG_NAMESPACE...BUS_MATCH_ARG_NAMESPACE_LAST:
- case BUS_MATCH_MESSAGE_TYPE:
- assert_not_reached("FIXME!");
+ case BUS_MATCH_ARG...BUS_MATCH_ARG_LAST: {
+ char buf[sizeof("arg")-1 + 2 + 1];
+
+ snprintf(buf, sizeof(buf), "arg%u", c->type - BUS_MATCH_ARG);
+ bloom_add_pair(bloom, buf, c->value_str);
+ using_bloom = true;
+ break;
+ }
+
+ case BUS_MATCH_ARG_PATH...BUS_MATCH_ARG_PATH_LAST: {
+ char buf[sizeof("arg")-1 + 2 + sizeof("-slash-prefix")];
+
+ snprintf(buf, sizeof(buf), "arg%u-slash-prefix", c->type - BUS_MATCH_ARG_PATH);
+ bloom_add_pair(bloom, buf, c->value_str);
+ using_bloom = true;
+ break;
+ }
+
+ case BUS_MATCH_ARG_NAMESPACE...BUS_MATCH_ARG_NAMESPACE_LAST: {
+ char buf[sizeof("arg")-1 + 2 + sizeof("-dot-prefix")];
+
+ snprintf(buf, sizeof(buf), "arg%u-dot-prefix", c->type - BUS_MATCH_ARG_NAMESPACE);
+ bloom_add_pair(bloom, buf, c->value_str);
+ using_bloom = true;
+ break;
+ }
+
+ case BUS_MATCH_DESTINATION:
+ /* The bloom filter does not include
+ the destination, since it is only
+ available for broadcast messages
+ which do not carry a destination
+ since they are undirected. */
break;
case BUS_MATCH_ROOT: