Return immediately when using d_residual.
authorEric Blossom <eb@comsec.com>
Thu, 20 May 2010 03:38:17 +0000 (20:38 -0700)
committerEric Blossom <eb@comsec.com>
Thu, 20 May 2010 03:38:17 +0000 (20:38 -0700)
(Otherwise recv may overwrite valid data in d_temp_buff.)

gnuradio-core/src/lib/io/gr_udp_source.cc

index 1197a0c436c79e16423533a121304cfebd1210c5..da5b8a19159b7c6c312662297aad4a2e50b74b1d 100755 (executable)
@@ -243,7 +243,10 @@ gr_udp_source::work (int noutput_items,
     // Update indexing of amount of bytes left in the buffer
     d_residual -= nbytes;
     d_temp_offset += nbytes;
-    // FIXME? Returning here could simplify life...
+
+    // Return now with what we've got.
+    assert(nbytes % d_itemsize == 0);
+    return nbytes/d_itemsize;
   }
 
 #if USE_SELECT