servlib/bundling/FragmentManager.cc
changeset 36 25401075f22b
parent 0 2b3e5ec03512
child 37 6023dbd1cef5
--- a/servlib/bundling/FragmentManager.cc	Fri Aug 12 13:55:56 2011 +0100
+++ b/servlib/bundling/FragmentManager.cc	Mon Aug 15 12:35:59 2011 +0100
@@ -432,9 +432,27 @@
     state->bundle()->mutable_payload()->
         write_data(fragment->payload(), 0, fraglen,
                    fragment->frag_offset());
-    
+
+
+    // XXX/lynch ensure that non-payload blocks are added to fragment bundle
+    // but only add one block of each type
+    BlockInfoVec::const_iterator block_i;
+    for (block_i =  fragment->recv_blocks().begin();
+         block_i != fragment->recv_blocks().end(); 
+         ++block_i)
+    {
+        if ( !state->bundle()->recv_blocks().has_block( block_i->type() ) &&
+             block_i->type() != BundleProtocol::PAYLOAD_BLOCK ) {
+
+            log_debug("Adding block(%d) to fragment bundle", block_i->type());
+
+            state->bundle()->mutable_recv_blocks()->
+                push_back(BlockInfo(*block_i));
+        }
+    }
     // XXX/jmmikkel this ensures that we have a set of blocks in the
     // reassembled bundle, but eventually reassembly will have to do much more
+    /*
     if (fragment->frag_offset() == 0 &&
         !state->bundle()->recv_blocks().empty())
     {
@@ -442,11 +460,15 @@
         for (block_i =  fragment->recv_blocks().begin();
              block_i != fragment->recv_blocks().end(); ++block_i)
         {
+
+            log_debug("Adding block(%d) to fragment bundle", (*block_i).type());
+
             state->bundle()->mutable_recv_blocks()->
                 push_back(BlockInfo(*block_i));
         }
     }
-    
+    */
+
     // check see if we're done
     if (! state->check_completed()) {
         return;