Hi,

serialsource.c does not have a maintainer attribution, so I'm posting this 
here.

In TinyOS 2.0.x, the C SDK's serialsource.c contains a logic error in 
write_serial_packet() that can cause a deadlock.  This situation occurs when 
write_serial_packet() is called by the host and the attached mote fails to 
see the ending SYNC delimiter sent (due to a communication error).  The host 
waits in read_and_process() for an ack from the mote, and the mote waits in 
RXSTATE_INFO for more data from the host.  The deadlock is broken if the mote 
forwards a radio packet to the host.

The patch below may be a suitable resolution.

Cheers,
Steve

Index: serialsource.c
===================================================================
--- serialsource.c      (revision 1024)
+++ serialsource.c      (working copy)
@@ -768,6 +768,9 @@
     {
       struct packet_list *entry;
       
+      if (source_wait(src, &deadline) < 0)
+       return 1;
+
       read_and_process(src);
       entry = pop_protocol_packet(src, P_ACK);
       if (entry)
@@ -779,8 +782,6 @@
          if (acked == src->send.seqno)
            return 0;
        }
-      else if (source_wait(src, &deadline) < 0)
-       return 1;
     }
 }
 
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to