From e86827511b35231679085dc236e9744184ed4609 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Sat, 14 Apr 2012 14:33:59 +0200 Subject: Filters can transform user subscriptions to wire subscription Till now the subscription, as specified by the user, was send upstream. This patch allows SUB-side filter to transform the user subscription into wire subscription. For example, only a has can be sent upstream instead of a perfect subscription. Signed-off-by: Martin Sustrik --- src/prefix_filter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/prefix_filter.cpp') diff --git a/src/prefix_filter.cpp b/src/prefix_filter.cpp index 0514763..1a9b8ac 100644 --- a/src/prefix_filter.cpp +++ b/src/prefix_filter.cpp @@ -525,14 +525,16 @@ static void sf_destroy (void *core_, void *sf_) static int sf_subscribe (void *core_, void *sf_, const unsigned char *data_, size_t size_) { - pfx_add ((pfx_node_t*) sf_, data_, size_, NULL); + if (pfx_add ((pfx_node_t*) sf_, data_, size_, NULL)) + return xs_filter_subscribed (core_, data_, size_); return 0; } static int sf_unsubscribe (void *core_, void *sf_, const unsigned char *data_, size_t size_) { - pfx_rm ((pfx_node_t*) sf_, data_, size_, NULL); + if (pfx_rm ((pfx_node_t*) sf_, data_, size_, NULL)) + return xs_filter_unsubscribed (core_, data_, size_); return 0; } -- cgit v1.2.3