FS-2966 I already fixed this in the wait_for_state, so i copied the same fix to wait_for_state_timeout, the lua one needed a similar call to wait for the state to change to avoid a race, both of you should be fixed with this patch
This commit is contained in:
parent
08496cd7eb
commit
f33e9c6ede
|
@ -1206,18 +1206,20 @@ SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, sw
|
|||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout)
|
||||
SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *channel, switch_channel_state_t want_state, uint32_t timeout)
|
||||
{
|
||||
switch_channel_state_t state;
|
||||
uint32_t count = 0;
|
||||
|
||||
for (;;) {
|
||||
state = switch_channel_get_running_state(other_channel);
|
||||
state = switch_channel_get_running_state(channel);
|
||||
|
||||
if (state >= want_state) {
|
||||
if ((channel->state == channel->running_state && channel->running_state == want_state) || channel->state >= CS_HANGUP) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch_cond_next();
|
||||
|
||||
if (++count >= timeout) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -516,6 +516,7 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid, CoreSession *a_
|
|||
switch_set_flag(this, S_HUP);
|
||||
uuid = strdup(switch_core_session_get_uuid(session));
|
||||
switch_channel_set_state(switch_core_session_get_channel(session), CS_SOFT_EXECUTE);
|
||||
switch_channel_wait_for_state(switch_core_session_get_channel(session), switch_core_session_get_channel(a_leg->session), CS_SOFT_EXECUTE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue