servlib/bundling/BundleDaemon.cc
changeset 64 1296a0283271
parent 62 935bf9f13cfc
child 66 e1101c5d54a1
--- a/servlib/bundling/BundleDaemon.cc	Tue Oct 18 11:52:07 2011 +0100
+++ b/servlib/bundling/BundleDaemon.cc	Mon Oct 24 18:28:33 2011 +0100
@@ -2675,7 +2675,7 @@
      * At this point the BPQ Block has been found in the bundle
      */
     ASSERT ( block != NULL );
-    BPQBlock bpq_block(const_cast<BlockInfo*> (block) );
+    BPQBlock bpq_block( bundle );
 
     log_info_p("/dtn/daemon/bpq", "handle_bpq_block: Kind: %d Query: %s",
         (int)  bpq_block.kind(),
@@ -2687,9 +2687,11 @@
     				(char*)bpq_block.query_val());
             event->daemon_only_ = true;
         }
+
     } else if (bpq_block.kind() == BPQBlock::KIND_RESPONSE) {
     	// don't accept local responses
-    	if (!local_bundle) {
+    	if (!local_bundle &&
+    		!bundle->is_fragment()	) {//TODO: remove this temp frag exclusion
 
     		if (bpq_cache()->add_response_bundle(bundle, &bpq_block) &&
     			event->source_ != EVENTSRC_STORE) {
@@ -2698,6 +2700,22 @@
 				actions_->store_add(bundle);
     		}
     	}
+    } else if (bpq_block.kind() == BPQBlock::KIND_RESPONSE_DO_NOT_CACHE_FRAG) {
+
+    	// don't accept local responses
+    	if (!local_bundle &&
+    		!bundle->is_fragment()	) {
+
+    		if (bpq_cache()->add_response_bundle(bundle, &bpq_block) &&
+    			event->source_ != EVENTSRC_STORE) {
+
+    			bundle->set_in_datastore(true);
+				actions_->store_add(bundle);
+    		}
+    	}
+
+
+    	log_info_p("/dtn/daemon/bpq", "Query: %s answered completely");
     } else {
         log_err_p("/dtn/daemon/bpq", "ERROR - BPQ Block: invalid kind %d", 
             bpq_block.kind());