> outstandingReceptionHead is the head of a singly-linked list of  
> packets that the node is currently hearing. The above lines of code  
> find the node in the list that precedes the packet in question  
> (predecessor). If there is no preceding node, then it must be the  
> head of the list. The next lines of code remove it from the list:
> 
>      if (predecessor) {
>        predecessor->next = mine->next;
>      }
>      else if (mine == outstandingReceptionHead) { // must be head
>        outstandingReceptionHead = mine->next;
>      }
> 
> These lines occur before the test you originally mentioned.
> 
> I'll check in some comments to explain this.
> 
> Phil



Ok, I have understood the code that removes the packet from the list and the 
following test, but I have originally mentioned the test inside the first 
"while" (see the arrow):

void sim_gain_receive_handle(sim_event_t* evt) {
    receive_message_t* mine = (receive_message_t*)evt->data;
    receive_message_t* predecessor = NULL;
    receive_message_t* list = outstandingReceptionHead;
    dbg("Gain", "Handling reception event @ %s.\n", sim_time_string());
    while (list != NULL) {
      if (list->next == mine) {
        predecessor = list;
      }
      if (list != mine) {
=====>  if ((list->power - sim_gain_sensitivity()) < heardSignal()) {
          dbg("Gain", "Lost packet from %i as I concurrently received a
               packet stronger than %lf\n", list->source, list->power);
          list->lost = 1;
        }
      }
      list = list->next;
    }
    .....
    
This cycle, as you have said, finds the node in the list that precedes the 
packet... and (I think) it sets to "1" the "lost" member of the packets that 
the node is currently hearing but that are different from "mine"; i.e. the test 
(see the arrow) is always true for the packets "!= mine".

n.b.: I'm interesting in this, because I would modify Tossim to allow 
interactions between actual and virtual motes (an augmented simulator).

Thanks for your replies, Salvo.



------------------------------------------------------
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada



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

Reply via email to