Merge branch 'dfsg-orig'
[debian/gnuradio] / gnuradio-core / src / lib / io / gr_udp_source.cc
old mode 100755 (executable)
new mode 100644 (file)
index 1197a0c..fea9a26
@@ -243,21 +243,20 @@ 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
-  // Use select() to determine when socket is readable
-  fd_set readfds;
-  timeval timeout;
-#endif
-  
   while(1) {
     // get the data into our output buffer and record the number of bytes
 
 #if USE_SELECT
     // RCV_TIMEO doesn't work on all systems (e.g., Cygwin)
     // use select() instead of, or in addition to RCV_TIMEO
+    fd_set readfds;
+    timeval timeout;
     timeout.tv_sec = 1;          // Init timeout each iteration.  Select can modify it.
     timeout.tv_usec = 0;
     FD_ZERO(&readfds);