# HG changeset patch # User aidan # Date 1318514384 -3600 # Node ID 166a3782491cb52957eb39652f7e821788a99ebb # Parent 64954ed8a0a1f63abecea331d79bd5d5d28e7010 updated bpq handler to not cache local bundles when they are received back from the bundle store diff -r 64954ed8a0a1 -r 166a3782491c servlib/bundling/BundleDaemon.cc --- a/servlib/bundling/BundleDaemon.cc Thu Oct 13 10:58:18 2011 +0100 +++ b/servlib/bundling/BundleDaemon.cc Thu Oct 13 14:59:44 2011 +0100 @@ -739,7 +739,7 @@ default: s10_bundle(S10_OHCRAP,bundle,NULL,0,0,NULL,"__FILE__:__LINE__"); - log_debug("S10_OHCRAP - nknown eventsrc: %s", event->source_); + log_debug("S10_OHCRAP - unknown eventsrc: %d", event->source_); NOTREACHED; } @@ -2625,12 +2625,14 @@ BundleDaemon::handle_bpq_block(Bundle* bundle, BundleReceivedEvent* event) { const BlockInfo* block = NULL; + bool local_bundle = true; switch (event->source_) { case EVENTSRC_PEER: if (bundle->recv_blocks().has_block(BundleProtocol::QUERY_EXTENSION_BLOCK)) { block = bundle->recv_blocks(). find_block(BundleProtocol::QUERY_EXTENSION_BLOCK); + local_bundle = false; } else { return false; } @@ -2640,6 +2642,7 @@ if (bundle->api_blocks()->has_block(BundleProtocol::QUERY_EXTENSION_BLOCK)) { block = bundle->api_blocks()-> find_block(BundleProtocol::QUERY_EXTENSION_BLOCK); + local_bundle = true; } else { return false; } @@ -2650,10 +2653,12 @@ if (bundle->recv_blocks().has_block(BundleProtocol::QUERY_EXTENSION_BLOCK)) { block = bundle->recv_blocks(). find_block(BundleProtocol::QUERY_EXTENSION_BLOCK); - } + local_bundle = false; + } else if (bundle->api_blocks()->has_block(BundleProtocol::QUERY_EXTENSION_BLOCK)) { block = bundle->api_blocks()-> find_block(BundleProtocol::QUERY_EXTENSION_BLOCK); + local_bundle = true; } else { return false; } @@ -2683,15 +2688,14 @@ event->daemon_only_ = true; } } - else if (bpq_block.kind() == BPQBlock::KIND_RESPONSE) { - // don't accept local responses - if (event->source_ != EVENTSRC_APP) { - if (bpq_cache()->add_response_bundle(bundle, &bpq_block) && - event->source_ != EVENTSRC_STORE) { - bundle->set_in_datastore(true); - actions_->store_add(bundle); - } - } + // don't accept local responses + else if (bpq_block.kind() == BPQBlock::KIND_RESPONSE && !local_bundle) { + if (bpq_cache()->add_response_bundle(bundle, &bpq_block) && + event->source_ != EVENTSRC_STORE) { + + bundle->set_in_datastore(true); + actions_->store_add(bundle); + } } else { log_err_p("/dtn/daemon/bpq", "ERROR - BPQ Block: invalid kind %d",