From: Simon D. <sim...@us...> - 2012-10-05 15:58:00
|
Summary of changes: core/net/neighbor-info.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) - Log ----------------------------------------------------------------- commit dbd4f1c5790c6eb36a3b07ad0284731aebc27592 Author: simonduq <sim...@si...> Date: Fri Oct 5 17:24:23 2012 +0200 Force call of subscriber_callback when the ETX of a link is estimated for the first time. Otherwise, it was not called in case of NO_ACK. diff --git a/core/net/neighbor-info.c b/core/net/neighbor-info.c index b617899..b0492e1 100644 --- a/core/net/neighbor-info.c +++ b/core/net/neighbor-info.c @@ -61,12 +61,14 @@ update_metric(const rimeaddr_t *dest, int packet_metric) link_metric_t *metricp; link_metric_t recorded_metric, new_metric; unsigned long time; + int first_update = 0; metricp = (link_metric_t *)neighbor_attr_get_data(&attr_etx, dest); packet_metric = NEIGHBOR_INFO_ETX2FIX(packet_metric); if(metricp == NULL || *metricp == 0) { recorded_metric = NEIGHBOR_INFO_ETX2FIX(ETX_LIMIT); new_metric = packet_metric; + first_update = 1; } else { recorded_metric = *metricp; /* Update the EWMA of the ETX for the neighbor. */ @@ -84,7 +86,7 @@ update_metric(const rimeaddr_t *dest, int packet_metric) time = clock_seconds(); neighbor_attr_set_data(&attr_etx, dest, &new_metric); neighbor_attr_set_data(&attr_timestamp, dest, &time); - if(new_metric != recorded_metric && subscriber_callback != NULL) { + if((first_update || new_metric != recorded_metric) && subscriber_callback != NULL) { subscriber_callback(dest, 1, new_metric); } } ----------------------------------------------------------------------- -- contiki |