summaryrefslogtreecommitdiff
path: root/nuttx/net/uip/uip_igmpgroup.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-07-10 17:02:52 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-07-10 17:02:52 +0000
commitc4680a4704fd377f4c89e0b8f6149f3aec8b39fb (patch)
tree60fc2d19e0d4f1f306ac20f144da5fa493e96e31 /nuttx/net/uip/uip_igmpgroup.c
parenta87d861c4e0a60e1dc163f58c1b51eec13ababf3 (diff)
downloadpx4-nuttx-c4680a4704fd377f4c89e0b8f6149f3aec8b39fb.tar.gz
px4-nuttx-c4680a4704fd377f4c89e0b8f6149f3aec8b39fb.tar.bz2
px4-nuttx-c4680a4704fd377f4c89e0b8f6149f3aec8b39fb.zip
More IGMP logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2781 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/uip/uip_igmpgroup.c')
-rwxr-xr-xnuttx/net/uip/uip_igmpgroup.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/nuttx/net/uip/uip_igmpgroup.c b/nuttx/net/uip/uip_igmpgroup.c
index f51b8d542..62d3a7a5d 100755
--- a/nuttx/net/uip/uip_igmpgroup.c
+++ b/nuttx/net/uip/uip_igmpgroup.c
@@ -191,6 +191,7 @@ FAR struct igmp_group_s *uip_grpalloc(FAR struct uip_driver_s *dev, FAR uip_ipad
/* Initialize the non-zero elements of the group structure */
uip_ipaddr_copy(group->grpaddr, addr);
+ sem_init(&group->sem, 0, 0);
/* Interrupts must be disabled in order to modify the group list */
@@ -277,6 +278,15 @@ void uip_grpfree(FAR struct uip_driver_s *dev, FAR struct igmp_group_s *group)
irqstate_t flags = irqsave();
DEBUGASSERT(sq_rem((FAR sq_entry_t*)group, &dev->grplist) != NULL);
+
+ /* Destroy the wait semapore */
+
+ (void)sem_destroy(&group->sem);
+
+ /* Then release the group structure resources. Check first if this is one
+ * of the pre-allocated group structures that we will retain in a free list.
+ */
+
if (IS_PREALLOCATED(group->flags))
{
sq_addlast((FAR sq_entry_t*)group, &g_freelist);
@@ -284,6 +294,10 @@ void uip_grpfree(FAR struct uip_driver_s *dev, FAR struct igmp_group_s *group)
}
else
{
+ /* No.. deallocate the group structure. Use sched_free() just in case
+ * this function is executing within an interrupt handler.
+ */
+
irqrestore(flags);
sched_free(group);
}