net: contiki: Fix timer callback condition

etimer_expired will return true only once. This means periodic timers in
the netstack won't get to run since etimer_process calls etimer_expired
for all timers in the stack.

Jira: ZEP-475

Change-Id: I28da638789b0604f9dd0a0598a7fa590e6b0a746
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
This commit is contained in:
Jaakko Hannikainen 2016-08-02 14:47:36 +03:00 committed by Inaky Perez-Gonzalez
commit f77191976a

View file

@ -423,7 +423,7 @@ eventhandler(process_event_t ev, process_data_t data, struct net_buf *buf)
/* Check the clock so see if we should call the periodic uIP /* Check the clock so see if we should call the periodic uIP
processing. */ processing. */
if(data == &periodic && if(data == &periodic &&
etimer_expired(&periodic) && !etimer_is_triggered(&periodic)) { !etimer_is_triggered(&periodic)) {
etimer_set_triggered(&periodic); etimer_set_triggered(&periodic);
#if UIP_TCP #if UIP_TCP
for(i = 0; i < UIP_CONNS; ++i) { for(i = 0; i < UIP_CONNS; ++i) {
@ -455,8 +455,7 @@ eventhandler(process_event_t ev, process_data_t data, struct net_buf *buf)
* check the timer for reassembly * check the timer for reassembly
*/ */
if(data == &uip_reass_timer && if(data == &uip_reass_timer &&
etimer_expired(&uip_reass_timer) && !etimer_is_triggered(&uip_reass_timer)) {
!etimer_is_triggered(&uip_reass_timer)) {
etimer_set_triggered(&uip_reass_timer); etimer_set_triggered(&uip_reass_timer);
uip_reass_over(); uip_reass_over();
tcpip_ipv6_output(buf); tcpip_ipv6_output(buf);
@ -473,16 +472,14 @@ eventhandler(process_event_t ev, process_data_t data, struct net_buf *buf)
}*/ }*/
#if !UIP_CONF_ROUTER #if !UIP_CONF_ROUTER
if(data == &uip_ds6_timer_rs && if(data == &uip_ds6_timer_rs &&
etimer_expired(&uip_ds6_timer_rs) && !etimer_is_triggered(&uip_ds6_timer_rs)) {
!etimer_is_triggered(&uip_ds6_timer_rs)) {
etimer_set_triggered(&uip_ds6_timer_rs); etimer_set_triggered(&uip_ds6_timer_rs);
uip_ds6_send_rs(buf); uip_ds6_send_rs(buf);
tcpip_ipv6_output(buf); tcpip_ipv6_output(buf);
} }
#endif /* !UIP_CONF_ROUTER */ #endif /* !UIP_CONF_ROUTER */
if(data == &uip_ds6_timer_periodic && if(data == &uip_ds6_timer_periodic &&
etimer_expired(&uip_ds6_timer_periodic) && !etimer_is_triggered(&uip_ds6_timer_periodic)) {
!etimer_is_triggered(&uip_ds6_timer_periodic)) {
etimer_set_triggered(&uip_ds6_timer_periodic); etimer_set_triggered(&uip_ds6_timer_periodic);
uip_ds6_periodic(buf); uip_ds6_periodic(buf);
tcpip_ipv6_output(buf); tcpip_ipv6_output(buf);