move logic down a step

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10216 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-11-01 16:18:04 +00:00
parent 8152198348
commit f7d78f8626
2 changed files with 3 additions and 5 deletions

View File

@ -45,7 +45,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio
switch_status_t status = SWITCH_STATUS_FALSE;
if (session->rwlock) {
if (switch_test_flag(session, SSF_DESTROYED)) {
if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_get_state(session->channel) >= CS_HANGUP) {
status = SWITCH_STATUS_FALSE;
#ifdef SWITCH_DEBUG_RWLOCKS
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock FAIL\n",

View File

@ -57,11 +57,9 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(const char *u
if ((session = switch_core_hash_find(session_manager.session_table, uuid_str))) {
/* Acquire a read lock on the session */
#ifdef SWITCH_DEBUG_RWLOCKS
if (switch_channel_get_state(session->channel) >= CS_HANGUP || switch_test_flag(session, SSF_DESTROYED) ||
switch_core_session_perform_read_lock(session, file, func, line) != SWITCH_STATUS_SUCCESS) {
if (switch_core_session_perform_read_lock(session, file, func, line) != SWITCH_STATUS_SUCCESS) {
#else
if (switch_channel_get_state(session->channel) >= CS_HANGUP || switch_test_flag(session, SSF_DESTROYED) ||
switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
#endif
/* not available, forget it */
session = NULL;