[Freeswitch-trunk] [commit] r3668 - freeswitch/trunk/src/mod/applications/mod_conference

Freeswitch SVN anthm at freeswitch.org
Thu Dec 14 22:07:45 EST 2006


Author: anthm
Date: Thu Dec 14 22:07:44 2006
New Revision: 3668

Modified:
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c

Log:
fix

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Thu Dec 14 22:07:44 2006
@@ -475,7 +475,7 @@
 	switch_mutex_lock(member->flag_mutex);
 
 	for (imember = conference->members; imember; imember = imember->next) {
-		if (imember == member ) {
+		if (imember == member) {
 			if (last) {
 				last->next = imember->next;
 			} else {
@@ -487,6 +487,29 @@
 	}
 
 
+    if (member->fnode) { /* Close Unused Handles */
+        confernce_file_node_t *fnode, *cur;
+        switch_memory_pool_t *pool;
+        
+        fnode = member->fnode;
+        while(fnode) {
+            cur = fnode;
+            fnode = fnode->next;
+
+            if (cur->type == NODE_TYPE_SPEECH) {
+                switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+                switch_core_speech_close(&cur->sh, &flags);
+            } else {
+                switch_core_file_close(&cur->fh);
+            }
+            
+            pool = cur->pool;
+            switch_core_destroy_memory_pool(&pool);
+        }
+
+        member->fnode = NULL;
+    }
+
 	member->conference = NULL;
 
 	if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
@@ -745,6 +768,28 @@
 
 		switch_mutex_lock(conference->mutex);
 
+		if (conference->fnode) { /* Close Unused Handles */
+			confernce_file_node_t *fnode, *cur;
+			switch_memory_pool_t *pool;
+
+            fnode = conference->fnode;
+            while (fnode) {
+                cur = fnode;
+                fnode = fnode->next;
+
+                if (cur->type == NODE_TYPE_SPEECH) {
+                    switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+                    switch_core_speech_close(&cur->sh, &flags);
+                } else {
+                    switch_core_file_close(&cur->fh);
+                }
+
+                pool = cur->pool;
+                switch_core_destroy_memory_pool(&pool);
+            }
+            conference->fnode = NULL;
+		}
+
 		for(imember = conference->members; imember; imember = imember->next) {
 			switch_channel_t *channel;
 
@@ -1583,11 +1628,11 @@
 	} else {
 		member->fnode = fnode;
 	}
-	switch_mutex_unlock(member->flag_mutex);
 
 	/* Begin Generation */
 	switch_sleep(200000);
 	switch_core_speech_feed_tts(&fnode->sh, text, &flags);
+	switch_mutex_unlock(member->flag_mutex);
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -1651,11 +1696,11 @@
 	} else {
 		conference->fnode = fnode;
 	}
-	switch_mutex_unlock(conference->mutex);
 
 	/* Begin Generation */
 	switch_sleep(200000);
 	switch_core_speech_feed_tts(&fnode->sh, text, &flags);
+	switch_mutex_unlock(conference->mutex);
 
 	return SWITCH_STATUS_SUCCESS;
 }



More information about the Freeswitch-trunk mailing list