From 158d1f4631fa07be2a74e58a8781d6432466bbce Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 24 Jun 2007 19:47:39 +0000 Subject: [PATCH] kill mysterious race bug that magicly showed up last week git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5455 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/applications/mod_conference/mod_conference.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 3db81c107d..905ba8529b 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1576,6 +1576,8 @@ static void conference_loop_output(conference_member_t * member) switch_event_t *event; caller_control_action_t *caller_action = NULL; + switch_mutex_lock(member->flag_mutex); + if (switch_core_session_dequeue_event(member->session, &event) == SWITCH_STATUS_SUCCESS) { char *from = switch_event_get_header(event, "from"); char *to = switch_event_get_header(event, "to"); @@ -1649,7 +1651,6 @@ static void conference_loop_output(conference_member_t * member) /* handle file and TTS frames */ if (member->fnode) { - switch_mutex_lock(member->flag_mutex); /* if we are done, clean it up */ if (member->fnode->done) { conference_file_node_t *fnode; @@ -1707,7 +1708,6 @@ static void conference_loop_output(conference_member_t * member) } } } - switch_mutex_unlock(member->flag_mutex); } else { /* send the conferecne frame to the call leg */ switch_buffer_t *use_buffer = NULL; uint32_t mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer); @@ -1770,6 +1770,7 @@ static void conference_loop_output(conference_member_t * member) switch_core_timer_next(&timer); } } + switch_mutex_unlock(member->flag_mutex); } /* Rinse ... Repeat */ if (member->digit_stream != NULL) { @@ -3229,12 +3230,13 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t * conference, swit } /* move the member from the old conference to the new one */ + switch_mutex_lock(member->flag_mutex); conference_del_member(conference, member); conference_add_member(new_conference, member); switch_mutex_unlock(new_conference->mutex); - + switch_mutex_unlock(member->flag_mutex); stream->write_function(stream, "OK Members sent to conference %s.\n", argv[2]); - + /* tell them what happened */ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(channel, event);