[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/tossim
TossimPacketModelC.nc, 1.6, 1.7 sim_tossim.c, 1.5, 1.6
Phil Levis
scipio at users.sourceforge.net
Thu Jun 14 17:45:21 PDT 2007
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv3923
Modified Files:
TossimPacketModelC.nc sim_tossim.c
Log Message:
Check function pointers.
Index: TossimPacketModelC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim/TossimPacketModelC.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** TossimPacketModelC.nc 21 May 2007 21:35:54 -0000 1.6
--- TossimPacketModelC.nc 15 Jun 2007 00:45:18 -0000 1.7
***************
*** 68,71 ****
--- 68,72 ----
uint8_t sendingLength = 0;
int destNode;
+ sim_event_t sendEvent;
message_t receiveBuffer;
***************
*** 78,81 ****
--- 79,86 ----
dbg("TossimPacketModelC", "TossimPacketModelC: Init.init() called\n");
initialized = TRUE;
+ // We need to cancel in case an event is still lying around in the queue from
+ // before a reboot. Otherwise, the event will be executed normally (node is on),
+ // but its memory has been zeroed out.
+ sendEvent.cancelled = 1;
return SUCCESS;
}
***************
*** 168,172 ****
}
- sim_event_t sendEvent;
void send_backoff(sim_event_t* evt);
void send_transmit(sim_event_t* evt);
--- 173,176 ----
Index: sim_tossim.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/tossim/sim_tossim.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** sim_tossim.c 1 Apr 2007 00:29:34 -0000 1.5
--- sim_tossim.c 15 Jun 2007 00:45:18 -0000 1.6
***************
*** 112,117 ****
sim_set_node(event->mote);
! dbg("Tossim", "CORE: popping event for %i at %llu... ", sim_node(), sim_time());
! if (sim_mote_is_on(event->mote) || event->force) {
result = TRUE;
dbg_clear("Tossim", " mote is on (or forced event), run it.\n");
--- 112,120 ----
sim_set_node(event->mote);
! // Need to test whether function pointers are for statically
! // allocted events that are zeroed out on reboot
! dbg("Tossim", "CORE: popping event 0x%p for %i at %llu with handler %p... ", event, sim_node(), sim_time(), event->handle);
! if ((sim_mote_is_on(event->mote) || event->force) &&
! event->handle != NULL) {
result = TRUE;
dbg_clear("Tossim", " mote is on (or forced event), run it.\n");
***************
*** 121,125 ****
dbg_clear("Tossim", "\n");
}
! event->cleanup(event);
}
--- 124,130 ----
dbg_clear("Tossim", "\n");
}
! if (event->cleanup != NULL) {
! event->cleanup(event);
! }
}
More information about the Tinyos-2-commits
mailing list