]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
last round of google cleanup rebuild libdingaling
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 18 Aug 2006 18:44:11 +0000 (18:44 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 18 Aug 2006 18:44:11 +0000 (18:44 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2327 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/libdingaling/src/libdingaling.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c

index cbb95bbe83ff041a9c32758cc0b8ed0e6e853737..9a27e44e8441996d06cc56f4ec764064924231d9 100644 (file)
@@ -201,16 +201,20 @@ ldl_status ldl_session_destroy(ldl_session_t **session_p)
 
        if (session) {
                apr_pool_t *pool = session->pool;
+               apr_hash_t *hash = session->handle->sessions;
 
                if (globals.debug) {
                        globals.logger(DL_LOG_DEBUG, "Destroyed Session %s\n", 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) {
-                       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);
                pool = 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 *type = iks_find_attrib(pak->x, "type");
        uint8_t is_result = strcasecmp(type, "result") ? 0 : 1;
+       uint8_t is_error = strcasecmp(type, "error") ? 0 : 1;
+
        iks *xml;
 
        if (is_result) {
@@ -550,18 +556,18 @@ 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);
                if (is_result) {
                        if (handle->response_callback) {
                                handle->response_callback(handle, iqid); 
                        }
                        return IKS_FILTER_EAT;
+               } else if (is_error) {
+                       return IKS_FILTER_EAT;
                }
        }
-
-
-
        
        xml = iks_child (pak->x);
        while (xml) {
index 5efafe6ebc2283cbaf4e99e2f771240e518fa85e..d7e57a96a300c0e03088c2a8f51162321e0eaabf 100644 (file)
@@ -65,7 +65,8 @@ typedef enum {
        TFLAG_LANADDR = (1 << 16),
        TFLAG_AUTO = (1 << 17),
        TFLAG_DTMF = (1 << 18),
-       TFLAG_TIMER = ( 1 << 19)
+       TFLAG_TIMER = ( 1 << 19),
+       TFLAG_TERM = ( 1 << 20)
 } TFLAGS;
 
 typedef enum {
@@ -185,7 +186,10 @@ static void terminate_session(switch_core_session_t **session, switch_call_cause
                assert(tech_pvt != NULL);
 
                if (tech_pvt->dlsession) {
-                       ldl_session_terminate(tech_pvt->dlsession);
+                       if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+                               ldl_session_terminate(tech_pvt->dlsession);
+                               switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+                       }
                        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);
        
        if (tech_pvt->dlsession) {
-               ldl_session_terminate(tech_pvt->dlsession);
+               if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+                       ldl_session_terminate(tech_pvt->dlsession);
+                       switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+               }
                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);
 
                        if (tech_pvt->dlsession) {
-                               ldl_session_terminate(tech_pvt->dlsession);
+                               if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+                                       ldl_session_terminate(tech_pvt->dlsession);
+                                       switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+                               }
                                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_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_set_flag(tech_pvt, TFLAG_TERM);
                        switch_set_flag(tech_pvt, TFLAG_BYE);
                        switch_clear_flag(tech_pvt, TFLAG_IO);
                        switch_mutex_unlock(tech_pvt->flag_mutex);