On Friday 13 July 2007 12:35:07 pm David Gay wrote:
> On 7/3/07, Steve McKown <[EMAIL PROTECTED]> wrote:
> > 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.
>
> I've checked in a fix for this - I believe the problem is that
> write_serial_packet should always be checking for acks in non-blocking
> mode even when the serial_source isn't non-blocking (as far as I can
> tell, the old code would never deadlock with a non-blocking serial
> source). So the fix is slightly different from the one below.
>
> Let me know if the modified version (in CVS on the tinyos 2.x tree)
> still doesn't work...

I just tried the CVS code.  write_serial_packet() is always returning 1 now.  
I'll be taking a closer look to see if I can glean more meaningful feedback.

Steve

>
> David Gay
>
> > 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
>
> !DSPAM:4697c636297881804284693!


_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to