]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
non-blocking read fix from Steve McKown
authoridgay <idgay>
Mon, 16 Jul 2007 15:58:16 +0000 (15:58 +0000)
committeridgay <idgay>
Mon, 16 Jul 2007 15:58:16 +0000 (15:58 +0000)
support/sdk/c/serialsource.c

index 2da6968cc9ac1fcec019e5112511b234f2ca6a96..4e4afabd718cc2f51e250af6c9e981271c13c309 100644 (file)
@@ -627,11 +627,11 @@ void *read_serial_packet(serial_source src, int *len)
      the serial source is in non-blocking mode
 */
 {
+  read_and_process(src, TRUE);
   for (;;)
     {
       struct packet_list *entry;
 
-      read_and_process(src, src->non_blocking);
       entry = pop_protocol_packet(src, P_PACKET_NO_ACK);
       if (entry)
        {
@@ -645,6 +645,7 @@ void *read_serial_packet(serial_source src, int *len)
       if (src->non_blocking && serial_source_empty(src))
        return NULL;
       source_wait(src, NULL);
+      read_and_process(src, src->non_blocking);
     }
 }