--- a/servlib/bundling/BPQBlock.cc Thu Aug 18 12:30:38 2011 +0100
+++ b/servlib/bundling/BPQBlock.cc Thu Aug 18 13:19:07 2011 +0100
@@ -218,7 +218,8 @@
log_err_p(LOG, "BPQBlock::initialise: buf_len() = %lu",
block->writable_contents()->buf_len());
- log_debug_p(LOG, "BPQBlock::initialise: reserving space in buffer");
+ log_debug_p(LOG, "BPQBlock::initialise: reserving space in buffer %lu",
+ flen);
block->writable_contents()->reserve(flen);
log_debug_p(LOG, "BPQBlock::initialise: new buf_len() = %lu",
block->writable_contents()->buf_len());
--- a/servlib/bundling/BPQBlockProcessor.cc Thu Aug 18 12:30:38 2011 +0100
+++ b/servlib/bundling/BPQBlockProcessor.cc Thu Aug 18 13:19:07 2011 +0100
@@ -95,10 +95,8 @@
// payload and the received blocks). This places them "outside"
// the original blocks.
- if ( (const_cast<Bundle*>(bundle))->api_blocks()->
- has_block(BundleProtocol::QUERY_EXTENSION_BLOCK) ) {
-
- log_info_p(LOG, "BPQBlock found in API Block Vec => created locally");
+ if ( list == BlockInfo::LIST_API ) {
+ log_info_p(LOG, "Adding BPQBlock found in API Block Vec to xmit_blocks");
ASSERT((*xmit_blocks)[0].type() == BundleProtocol::PRIMARY_BLOCK);
xmit_blocks->insert(xmit_blocks->begin() + 1, BlockInfo(this, source));
@@ -106,10 +104,9 @@
return BP_SUCCESS;
- } else if ( (const_cast<Bundle*>(bundle))->recv_blocks().
- has_block(BundleProtocol::QUERY_EXTENSION_BLOCK) ) {
+ } else if ( list == BlockInfo::LIST_RECEIVED ) {
- log_info_p(LOG, "BPQBlock found in Recv Block Vec => created remotly");
+ log_info_p(LOG, "Adding BPQBlock found in Recv Block Vec to xmit_blocks");
xmit_blocks->append_block(this, source);
ASSERT(xmit_blocks->has_block(BundleProtocol::QUERY_EXTENSION_BLOCK));
@@ -119,7 +116,7 @@
} else {
- log_info_p(LOG, "BPQBlock not found in bundle");
+ log_err_p(LOG, "BPQBlock not found in bundle");
return BP_FAIL;
}
}
--- a/servlib/bundling/BundleProtocol.cc Thu Aug 18 12:30:38 2011 +0100
+++ b/servlib/bundling/BundleProtocol.cc Thu Aug 18 13:19:07 2011 +0100
@@ -133,15 +133,12 @@
continue;
}
- log_debug_p(LOG, "adding recv_block %d", iter->type());
+ log_debug_p(LOG, "adding recv_block 0x%x", iter->type());
find_processor(iter->type())->prepare(bundle,
xmit_blocks,
&*iter,
link,
BlockInfo::LIST_RECEIVED);
-
-// iter->owner()->prepare(bundle, xmit_blocks, &*iter, link,
-// BlockInfo::LIST_RECEIVED);
}
}
else {
@@ -157,15 +154,12 @@
iter != api_blocks->end();
++iter)
{
- log_debug_p(LOG, "adding api_block %d", iter->type());
+ log_debug_p(LOG, "adding api_block 0x%x", iter->type());
find_processor(iter->type())->prepare(bundle,
xmit_blocks,
&*iter,
link,
BlockInfo::LIST_API);
-
-// iter->owner()->prepare(bundle, xmit_blocks,
-// &*iter, link, BlockInfo::LIST_API);
}
// now we also make sure to prepare() on any registered processors
@@ -183,10 +177,11 @@
if (! xmit_blocks->has_block(i)) {
- if (i == BundleProtocol::QUERY_EXTENSION_BLOCK)
- log_debug_p(LOG, "adding extra BPQ block!!!");
- else
+ if (i != BundleProtocol::QUERY_EXTENSION_BLOCK) {
bp->prepare(bundle, xmit_blocks, NULL, link, BlockInfo::LIST_NONE);
+ } else {
+ log_warn_p(LOG, "BPQ blocks should only be created by DTN applications");
+ }
}
}