tcpip.c, igmp.h, igmp.c: Fixed bug "#19800 : IGMP: igmp_tick() will not work with NO_SYS=1". Note that igmp_init is always in tcpip_thread (and not in tcpip_init) because we have to be sure that network interfaces are already added (mac filter is updated only in igmp_init for the moment).

This commit is contained in:
fbernon 2007-05-16 14:12:52 +00:00
parent 2e479b88a8
commit 0f8a2d6418
4 changed files with 28 additions and 19 deletions

View File

@ -158,6 +158,12 @@ HISTORY
++ Bug fixes: ++ Bug fixes:
2007-05-16 Frédéric Bernon
* tcpip.c, igmp.h, igmp.c: Fixed bug "#19800 : IGMP: igmp_tick() will not work
with NO_SYS=1". Note that igmp_init is always in tcpip_thread (and not in
tcpip_init) because we have to be sure that network interfaces are already
added (mac filter is updated only in igmp_init for the moment).
2007-05-16 Simon Goldschmidt 2007-05-16 Simon Goldschmidt
* mem.c, memp.c: Removed semaphores from memp, changed sys_sem_wait calls * mem.c, memp.c: Removed semaphores from memp, changed sys_sem_wait calls
into sys_arch_sem_wait calls to prevent timers from running while waiting into sys_arch_sem_wait calls to prevent timers from running while waiting

View File

@ -127,6 +127,17 @@ dhcp_timer_fine(void *arg)
} }
#endif /* LWIP_DHCP */ #endif /* LWIP_DHCP */
#if LWIP_IGMP
static void
igmp_timer(void *arg)
{
LWIP_UNUSED_ARG(arg);
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip: igmp_tmr()\n"));
igmp_tmr();
sys_timeout( IGMP_TMR_INTERVAL, igmp_timer, NULL);
}
#endif /* LWIP_IGMP */
#if ETHARP_TCPIP_ETHINPUT #if ETHARP_TCPIP_ETHINPUT
static void static void
ethernet_input(struct pbuf *p, struct netif *netif) ethernet_input(struct pbuf *p, struct netif *netif)
@ -180,17 +191,19 @@ tcpip_thread(void *arg)
sys_timeout( ARP_TMR_INTERVAL, arp_timer, NULL); sys_timeout( ARP_TMR_INTERVAL, arp_timer, NULL);
#endif /* LWIP_ARP */ #endif /* LWIP_ARP */
#if LWIP_DHCP #if LWIP_DHCP
sys_timeout(DHCP_COARSE_TIMER_SECS*1000, dhcp_timer_coarse, NULL); sys_timeout( DHCP_COARSE_TIMER_SECS*1000, dhcp_timer_coarse, NULL);
sys_timeout(DHCP_FINE_TIMER_MSECS, dhcp_timer_fine, NULL); sys_timeout( DHCP_FINE_TIMER_MSECS, dhcp_timer_fine, NULL);
#endif /* LWIP_DHCP */ #endif /* LWIP_DHCP */
#if LWIP_IGMP
igmp_init();
#endif /* LWIP_IGMP */
if (tcpip_init_done != NULL) { if (tcpip_init_done != NULL) {
tcpip_init_done(tcpip_init_done_arg); tcpip_init_done(tcpip_init_done_arg);
} }
#if LWIP_IGMP
igmp_init();
sys_timeout( IGMP_TMR_INTERVAL, igmp_timer, NULL);
#endif /* LWIP_IGMP */
while (1) { /* MAIN Loop */ while (1) { /* MAIN Loop */
sys_mbox_fetch(mbox, (void *)&msg); sys_mbox_fetch(mbox, (void *)&msg);
switch (msg->type) { switch (msg->type) {

View File

@ -121,10 +121,6 @@ void igmp_init(void)
} }
} }
} }
/* Start the 10 millisecond tick */
/* we can optimise this to only run when timers are active later on */
sys_timeout( IGMP_TICK, igmp_tick, NULL);
} }
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
@ -356,13 +352,11 @@ err_t igmp_leavegroup( struct netif *ifp, struct ip_addr *groupaddr)
} }
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
* igmp_tick * igmp_tmr
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void igmp_tick(void *arg) void igmp_tmr()
{ struct igmp_group *group = GroupList; { struct igmp_group *group = GroupList;
arg = arg;
while (group) while (group)
{ if (group->timer != 0) { if (group->timer != 0)
{ group->timer -=1; { group->timer -=1;
@ -372,10 +366,6 @@ void igmp_tick(void *arg)
} }
group = group->next; group = group->next;
} }
/* 100 millisecond tick handler */
/* go down the list of all groups here and check for timeouts */
sys_timeout (IGMP_TICK, igmp_tick, NULL);
} }
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------

View File

@ -71,7 +71,7 @@ struct igmpmsg {
#define IGMP_LEAVE_GROUP 0x17 /* Leave-group message */ #define IGMP_LEAVE_GROUP 0x17 /* Leave-group message */
/* Timer */ /* Timer */
#define IGMP_TICK 100 /* Milliseconds */ #define IGMP_TMR_INTERVAL 100 /* Milliseconds */
/* MAC Filter Actions */ /* MAC Filter Actions */
#define IGMP_DEL_MAC_FILTER 0 #define IGMP_DEL_MAC_FILTER 0
@ -137,7 +137,7 @@ err_t igmp_joingroup( struct netif* ifp, struct ip_addr *groupaddr);
err_t igmp_leavegroup( struct netif* ifp, struct ip_addr *groupaddr); err_t igmp_leavegroup( struct netif* ifp, struct ip_addr *groupaddr);
void igmp_tick(void *arg); void igmp_tmr();
void igmp_timeout( struct igmp_group *group); void igmp_timeout( struct igmp_group *group);