git-svn-id: http://svn.openzap.org/svn/openzap/trunk@298 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale
2007-06-27 19:18:13 +00:00
parent fa0e2fa919
commit a4942a13d6
5 changed files with 23 additions and 11 deletions

View File

@@ -577,12 +577,11 @@ zap_status_t zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t sta
{
int ok = 1;
zap_mutex_lock(zchan->mutex);
if (!zap_test_flag(zchan, ZAP_CHANNEL_READY)) {
return ZAP_FAIL;
}
zap_mutex_lock(zchan->mutex);
switch(zchan->state) {
case ZAP_CHANNEL_STATE_HANGUP:
case ZAP_CHANNEL_STATE_TERMINATING:
@@ -641,7 +640,7 @@ zap_status_t zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t sta
if (state == zchan->state) {
ok = 0;
}
if (ok) {
zap_set_flag(zchan, ZAP_CHANNEL_STATE_CHANGE);
zap_set_flag(zchan->span, ZAP_SPAN_STATE_CHANGE);
@@ -1209,11 +1208,13 @@ zap_status_t zap_channel_command(zap_channel_t *zchan, zap_command_t command, vo
if (!zchan->zio->command) {
snprintf(zchan->last_error, sizeof(zchan->last_error), "method not implemented");
zap_log(ZAP_LOG_ERROR, "no commnand functon!\n");
GOTO_STATUS(done, ZAP_FAIL);
}
status = zchan->zio->command(zchan, command, obj);
done:
zap_mutex_unlock(zchan->mutex);
return status;