updated frag manager
authoraidan
Mon, 15 Aug 2011 12:35:59 +0100
changeset 36 25401075f22b
parent 35 2bc8cc69d2a5
child 37 6023dbd1cef5
updated frag manager
servlib/bundling/FragmentManager.cc
--- 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;