From ececc3ca45d822361dedf324dbb6e33fe0134e53 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Mon, 8 Feb 2010 19:50:49 +0000 Subject: [PATCH] Internalize another function; use the supplied max_response_time instead of dividing it by 2 --- src/core/ipv4/igmp.c | 15 ++++++++------- src/include/ipv4/lwip/igmp.h | 1 - 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/ipv4/igmp.c b/src/core/ipv4/igmp.c index 65fbdebd..4909b5bd 100644 --- a/src/core/ipv4/igmp.c +++ b/src/core/ipv4/igmp.c @@ -135,6 +135,7 @@ PACK_STRUCT_END #endif +static struct igmp_group *igmp_lookup_group(struct netif *ifp, ip_addr_t *addr); static err_t igmp_remove_group(struct igmp_group *group); static void igmp_timeout( struct igmp_group *group); static void igmp_start_timer(struct igmp_group *group, u8_t max_time); @@ -698,7 +699,11 @@ igmp_timeout(struct igmp_group *group) static void igmp_start_timer(struct igmp_group *group, u8_t max_time) { - /* ensure the value is > 0 */ + /* ensure the input value is > 0 */ + if (max_time == 0) { + max_time = 1; + } + /* ensure the random value is > 0 */ group->timer = (LWIP_RAND() % (max_time - 1)) + 1; } @@ -722,14 +727,10 @@ igmp_stop_timer(struct igmp_group *group) static void igmp_delaying_member(struct igmp_group *group, u8_t maxresp) { - u8_t maxresphalf = maxresp / 2; - if (maxresphalf == 0) { - maxresphalf = 1; - } if ((group->group_state == IGMP_GROUP_IDLE_MEMBER) || ((group->group_state == IGMP_GROUP_DELAYING_MEMBER) && - ((group->timer == 0) || (maxresphalf < group->timer)))) { - igmp_start_timer(group, maxresphalf); + ((group->timer == 0) || (maxresp < group->timer)))) { + igmp_start_timer(group, maxresp); group->group_state = IGMP_GROUP_DELAYING_MEMBER; } } diff --git a/src/include/ipv4/lwip/igmp.h b/src/include/ipv4/lwip/igmp.h index 095606a3..8aabac24 100644 --- a/src/include/ipv4/lwip/igmp.h +++ b/src/include/ipv4/lwip/igmp.h @@ -92,7 +92,6 @@ err_t igmp_start(struct netif *netif); err_t igmp_stop(struct netif *netif); void igmp_report_groups(struct netif *netif); struct igmp_group *igmp_lookfor_group(struct netif *ifp, ip_addr_t *addr); -struct igmp_group *igmp_lookup_group(struct netif *ifp, ip_addr_t *addr); void igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest); err_t igmp_joingroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr); err_t igmp_leavegroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr);