[Tinyos-help] a problem when simulate Bcast in TOSSIM

shangzj shangzj at sia.cn
Sun Mar 27 16:27:38 PST 2005


I run the  Bcast app in apps/SimpleCmd. Normally, if every mote have received the packet with the same seqno, the process of rebroadcasting should stop. But, it will not happen in tossim. The process of rebroadcasting never stop at all! 
If I move the post forwarder() from the first event to the next event(see the following code), the program works well in tossim as i expected. I try the program with no modification on mica2 node. It works well. I guess the modification i made can't affect the function of the program, but it did work in tossim.

why? Is it a bug of tossim? ProcessCmd.done are signaled automaticly more than one time?
You can try this yourself. 
BTW: i use the 1.1.11 cvs snapshot version on linux RH9. 

  event result_t ProcessCmd.done(TOS_MsgPtr pmsg, result_t status) {
    msg = pmsg;
    //call Leds.redToggle();
    if (status) {
    // post forwarder(); 
    } else {
      bcast_pending = 0;
    return SUCCESS;

  event TOS_MsgPtr ReceiveCmdMsg.receive(TOS_MsgPtr pmsg){
    TOS_MsgPtr ret = msg;
    result_t retval;
    struct SimpleCmdMsg *data= (struct SimpleCmdMsg *)pmsg->data;
    // Check if this is a new broadcast message
    //call Leds.greenToggle();
    if (is_new_msg(data)) {
      retval = call ProcessCmd.execute(pmsg) ;
      post forwarder();//by Shang
      // Return a message buffer to the lower levels, and hold on to the
      // current buffer
      ret = msg;
      msg = pmsg;
    return ret;

Best regards.

Michael Shang

More information about the Tinyos-help mailing list