last round of google cleanup rebuild libdingaling

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2327 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-08-18 18:44:11 +00:00
parent 57da9ed8fc
commit 6ccb60c25c
2 changed files with 27 additions and 10 deletions

View File

@ -201,16 +201,20 @@ ldl_status ldl_session_destroy(ldl_session_t **session_p)
if (session) { if (session) {
apr_pool_t *pool = session->pool; apr_pool_t *pool = session->pool;
apr_hash_t *hash = session->handle->sessions;
if (globals.debug) { if (globals.debug) {
globals.logger(DL_LOG_DEBUG, "Destroyed Session %s\n", session->id); globals.logger(DL_LOG_DEBUG, "Destroyed Session %s\n", session->id);
} }
if (session->id) { if (session->id) {
apr_hash_set(session->handle->sessions, session->id, APR_HASH_KEY_STRING, NULL); apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL);
} }
if (session->them) { if (session->them) {
apr_hash_set(session->handle->sessions, session->them, APR_HASH_KEY_STRING, NULL); apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL);
} }
apr_pool_destroy(pool); apr_pool_destroy(pool);
pool = NULL; pool = NULL;
*session_p = NULL; *session_p = NULL;
@ -501,6 +505,8 @@ static int on_commands(void *user_data, ikspak *pak)
char *iqid = iks_find_attrib(pak->x, "id"); char *iqid = iks_find_attrib(pak->x, "id");
char *type = iks_find_attrib(pak->x, "type"); char *type = iks_find_attrib(pak->x, "type");
uint8_t is_result = strcasecmp(type, "result") ? 0 : 1; uint8_t is_result = strcasecmp(type, "result") ? 0 : 1;
uint8_t is_error = strcasecmp(type, "error") ? 0 : 1;
iks *xml; iks *xml;
if (is_result) { if (is_result) {
@ -550,19 +556,19 @@ static int on_commands(void *user_data, ikspak *pak)
} }
} }
if ((is_result || !strcasecmp(type, "error")) && iqid && from) { if ((is_result || is_error) && iqid && from) {
cancel_retry(handle, iqid); cancel_retry(handle, iqid);
if (is_result) { if (is_result) {
if (handle->response_callback) { if (handle->response_callback) {
handle->response_callback(handle, iqid); handle->response_callback(handle, iqid);
} }
return IKS_FILTER_EAT; return IKS_FILTER_EAT;
} else if (is_error) {
return IKS_FILTER_EAT;
} }
} }
xml = iks_child (pak->x); xml = iks_child (pak->x);
while (xml) { while (xml) {
char *name = iks_name(xml); char *name = iks_name(xml);

View File

@ -65,7 +65,8 @@ typedef enum {
TFLAG_LANADDR = (1 << 16), TFLAG_LANADDR = (1 << 16),
TFLAG_AUTO = (1 << 17), TFLAG_AUTO = (1 << 17),
TFLAG_DTMF = (1 << 18), TFLAG_DTMF = (1 << 18),
TFLAG_TIMER = ( 1 << 19) TFLAG_TIMER = ( 1 << 19),
TFLAG_TERM = ( 1 << 20)
} TFLAGS; } TFLAGS;
typedef enum { typedef enum {
@ -185,7 +186,10 @@ static void terminate_session(switch_core_session_t **session, switch_call_cause
assert(tech_pvt != NULL); assert(tech_pvt != NULL);
if (tech_pvt->dlsession) { if (tech_pvt->dlsession) {
if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
ldl_session_terminate(tech_pvt->dlsession); ldl_session_terminate(tech_pvt->dlsession);
switch_set_flag_locked(tech_pvt, TFLAG_TERM);
}
ldl_session_destroy(&tech_pvt->dlsession); ldl_session_destroy(&tech_pvt->dlsession);
} }
@ -682,7 +686,10 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
switch_set_flag_locked(tech_pvt, TFLAG_BYE); switch_set_flag_locked(tech_pvt, TFLAG_BYE);
if (tech_pvt->dlsession) { if (tech_pvt->dlsession) {
if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
ldl_session_terminate(tech_pvt->dlsession); ldl_session_terminate(tech_pvt->dlsession);
switch_set_flag_locked(tech_pvt, TFLAG_TERM);
}
ldl_session_destroy(&tech_pvt->dlsession); ldl_session_destroy(&tech_pvt->dlsession);
} }
@ -717,7 +724,10 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
switch_set_flag_locked(tech_pvt, TFLAG_BYE); switch_set_flag_locked(tech_pvt, TFLAG_BYE);
if (tech_pvt->dlsession) { if (tech_pvt->dlsession) {
if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
ldl_session_terminate(tech_pvt->dlsession); ldl_session_terminate(tech_pvt->dlsession);
switch_set_flag_locked(tech_pvt, TFLAG_TERM);
}
ldl_session_destroy(&tech_pvt->dlsession); ldl_session_destroy(&tech_pvt->dlsession);
} }
@ -1840,6 +1850,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
switch_channel_state_t state = switch_channel_get_state(channel); switch_channel_state_t state = switch_channel_get_state(channel);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hungup %s %u %d\n", switch_channel_get_name(channel), state, CS_INIT); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hungup %s %u %d\n", switch_channel_get_name(channel), state, CS_INIT);
switch_mutex_lock(tech_pvt->flag_mutex); switch_mutex_lock(tech_pvt->flag_mutex);
switch_set_flag(tech_pvt, TFLAG_TERM);
switch_set_flag(tech_pvt, TFLAG_BYE); switch_set_flag(tech_pvt, TFLAG_BYE);
switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_IO);
switch_mutex_unlock(tech_pvt->flag_mutex); switch_mutex_unlock(tech_pvt->flag_mutex);