summaryrefslogtreecommitdiff
path: root/src/prefix_filter.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-04-14 14:33:59 +0200
committerMartin Sustrik <sustrik@250bpm.com>2012-04-15 06:56:54 +0200
commite86827511b35231679085dc236e9744184ed4609 (patch)
treec8aea816ed2c5ed6b1d383367c6e34576b2c3d7c /src/prefix_filter.cpp
parent71cf5791422c7a461520fce8225342c27821e774 (diff)
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 <sustrik@250bpm.com>
Diffstat (limited to 'src/prefix_filter.cpp')
-rw-r--r--src/prefix_filter.cpp6
1 files changed, 4 insertions, 2 deletions
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;
}