# HG changeset patch # User aidan # Date 1318499898 -3600 # Node ID 64954ed8a0a1f63abecea331d79bd5d5d28e7010 # Parent e5674a26ce74fd50d0c41928f6ce65fad432ab4a included orig_length in bundle copy and fixed bpq handler in daemon diff -r e5674a26ce74 -r 64954ed8a0a1 servlib/bundling/BPQCache.cc --- a/servlib/bundling/BPQCache.cc Thu Oct 06 18:06:34 2011 +0100 +++ b/servlib/bundling/BPQCache.cc Thu Oct 13 10:58:18 2011 +0100 @@ -123,6 +123,8 @@ current_fragment, local_eid); + ASSERT(new_response->is_fragment() == current_fragment->is_fragment()); + BundleReceivedEvent* e = new BundleReceivedEvent(new_response, EVENTSRC_CACHE); BundleDaemon::instance()->post(e); diff -r e5674a26ce74 -r 64954ed8a0a1 servlib/bundling/BPQResponse.cc --- a/servlib/bundling/BPQResponse.cc Thu Oct 06 18:06:34 2011 +0100 +++ b/servlib/bundling/BPQResponse.cc Thu Oct 13 10:58:18 2011 +0100 @@ -40,6 +40,10 @@ // init metadata cached_response->copy_metadata(new_response); + // include info not copied over in prev function + new_response->set_orig_length(cached_response->orig_length()); + new_response->set_frag_offset(cached_response->frag_offset()); + // set EIDs new_response->mutable_source()->assign(local_eid); new_response->mutable_dest()->assign(query->replyto()); diff -r e5674a26ce74 -r 64954ed8a0a1 servlib/bundling/BundleDaemon.cc --- a/servlib/bundling/BundleDaemon.cc Thu Oct 06 18:06:34 2011 +0100 +++ b/servlib/bundling/BundleDaemon.cc Thu Oct 13 10:58:18 2011 +0100 @@ -929,10 +929,8 @@ event->source_ == EVENTSRC_STORE || event->source_ == EVENTSRC_FRAGMENTATION) { - // TODO: change this to allow fragment responses be sent -// if ( ! bundle->is_fragment() ) { handle_bpq_block(bundle, event); -// } + } // If the bundle contains a BPQ query that was successfully answered @@ -2633,6 +2631,8 @@ if (bundle->recv_blocks().has_block(BundleProtocol::QUERY_EXTENSION_BLOCK)) { block = bundle->recv_blocks(). find_block(BundleProtocol::QUERY_EXTENSION_BLOCK); + } else { + return false; } break; @@ -2640,19 +2640,12 @@ if (bundle->api_blocks()->has_block(BundleProtocol::QUERY_EXTENSION_BLOCK)) { block = bundle->api_blocks()-> find_block(BundleProtocol::QUERY_EXTENSION_BLOCK); + } else { + return false; } break; case EVENTSRC_STORE: - if (bundle->in_bpq_cache()) { - log_info_p("/dtn/daemon/bpq", "handle_bpq_block: cache bundle from STORE"); - BPQBlock bpq_block(bundle); - bpq_cache()->answer_query(bundle, &bpq_block); -// accept_bpq_response(bundle, &bpq_block, false); - return true; - } - break; - case EVENTSRC_FRAGMENTATION: if (bundle->recv_blocks().has_block(BundleProtocol::QUERY_EXTENSION_BLOCK)) { block = bundle->recv_blocks(). @@ -2661,6 +2654,8 @@ else if (bundle->api_blocks()->has_block(BundleProtocol::QUERY_EXTENSION_BLOCK)) { block = bundle->api_blocks()-> find_block(BundleProtocol::QUERY_EXTENSION_BLOCK); + } else { + return false; } break;