From ab15369af5cf3ebb0c4c0bf9bc804d8259328261 Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Mon, 7 Mar 2016 14:33:50 +1030 Subject: [PATCH] Use trigger function to clear out sync bars --- rhizome_sync.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/rhizome_sync.c b/rhizome_sync.c index 2ca45d31..85edaab9 100644 --- a/rhizome_sync.c +++ b/rhizome_sync.c @@ -245,12 +245,15 @@ static int sync_bundle_inserted(struct subscriber *subscriber, void *context) return 0; } -static int rhizome_sync_bundle_inserted(const rhizome_bar_t *bar) +static void rhizome_sync_bundle_inserted(rhizome_manifest *m) { - enum_subscribers(NULL, sync_bundle_inserted, (void *)bar); - return 0; + rhizome_bar_t bar; + rhizome_manifest_to_bar(m, &bar); + enum_subscribers(NULL, sync_bundle_inserted, (void *)&bar); } +DEFINE_TRIGGER(bundle_add, rhizome_sync_bundle_inserted); + static int sync_cache_bar(struct rhizome_sync *state, const rhizome_bar_t *bar, uint64_t token) { int ret=0; @@ -445,11 +448,6 @@ static void sync_send_response(struct subscriber *dest, int forwards, uint64_t t if (bar_size != RHIZOME_BAR_BYTES) continue; - if (rowid>max_token){ - // a new bundle has been imported - rhizome_sync_bundle_inserted((const rhizome_bar_t *)bar); - } - if (count < max_count){ // make sure we include the exact rowid that was requested, even if we just deleted / replaced the manifest if (count==0 && rowid!=token){