From 31bb54cf275fc88ae2e29c08e7c9e1b4006eb146 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 8 Jan 2008 03:00:57 +0000 Subject: [PATCH] avoid file handle leak git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7135 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../mod_conference/mod_conference.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 0322396859..6a9e0341b6 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -984,7 +984,8 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread, if (switch_test_flag(conference, CFLAG_DESTRUCT)) { switch_mutex_lock(conference->mutex); - + conference_stop_file(conference, FILE_STOP_ASYNC); + conference_stop_file(conference, FILE_STOP_ALL); /* Close Unused Handles */ if (conference->fnode) { conference_file_node_t *fnode, *cur; @@ -1005,6 +1006,14 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread, conference->fnode = NULL; } + if (conference->async_fnode) { + switch_memory_pool_t *pool; + switch_core_file_close(&conference->async_fnode->fh); + pool = conference->async_fnode->pool; + conference->async_fnode = NULL; + switch_core_destroy_memory_pool(&pool); + } + switch_mutex_lock(conference->member_mutex); for (imember = conference->members; imember; imember = imember->next) { switch_channel_t *channel; @@ -2782,7 +2791,7 @@ static switch_status_t conf_api_sub_volume_out(conference_member_t * member, swi static switch_status_t conf_api_sub_list(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv) { int ret_status = SWITCH_STATUS_GENERR; - + int count = 0; switch_hash_index_t *hi; void *val; char *d = ";"; @@ -2816,6 +2825,7 @@ static switch_status_t conf_api_sub_list(conference_obj_t * conference, switch_s stream->write_function(stream, "Conference %s (%u member%s%s)\n", conference->name, conference->count, conference->count == 1 ? "" : "s", switch_test_flag(conference, CFLAG_LOCKED) ? " locked" : ""); + count++; if (pretty) { conference_list_pretty(conference, stream); } else { @@ -2823,6 +2833,7 @@ static switch_status_t conf_api_sub_list(conference_obj_t * conference, switch_s } } } else { + count++; if (pretty) { conference_list_pretty(conference, stream); } else { @@ -2830,6 +2841,10 @@ static switch_status_t conf_api_sub_list(conference_obj_t * conference, switch_s } } + if (!count) { + stream->write_function(stream, "No active conferences.\n"); + } + ret_status = SWITCH_STATUS_SUCCESS; return ret_status;