]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
skip looking up session again in hash table when we already are parsing the event...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 4 Aug 2011 04:47:47 +0000 (23:47 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 4 Aug 2011 04:47:47 +0000 (23:47 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index b7db7985c6ef32b1124aa339658afcb3886b7948..39b71f1f88503f0f758b93ea138c43a8bfb9257c 100644 (file)
@@ -1388,6 +1388,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
        if (msg->message_id == SWITCH_MESSAGE_INDICATE_SIGNAL_DATA) {
                sofia_dispatch_event_t *de = (sofia_dispatch_event_t *) msg->pointer_arg;
                switch_mutex_lock(tech_pvt->sofia_mutex);
+               if (switch_core_session_in_thread(session)) {
+                       de->session = session;
+               }
                sofia_process_dispatch_event(&de);
                switch_mutex_unlock(tech_pvt->sofia_mutex);
                goto end;
index c20a45e6e4a7683603d58d3a38f7ad48356265a7..07c917cbcafef044e9c229eb9b3613180a04b9e0 100644 (file)
@@ -143,6 +143,7 @@ typedef struct sofia_dispatch_event_s {
        nua_t *nua;
        sofia_profile_t *profile;
        int save;
+       switch_core_session_t *session;
 } sofia_dispatch_event_t;
 
 struct sofia_private {
index 865feebbdeb299dcbdb9fd3f5be77db074cc0bdc..464f5ff50d4f08ed86fdf72f085ad4a7504bd59c 100644 (file)
@@ -818,14 +818,14 @@ static void our_sofia_event_callback(nua_event_t event,
                                return;
                        }
                } else if (!zstr(sofia_private->uuid)) {
-                       if ((session = switch_core_session_locate(sofia_private->uuid))) {
+                       if ((session = de->session) || (session = switch_core_session_locate(sofia_private->uuid))) {
                                tech_pvt = switch_core_session_get_private(session);
                                channel = switch_core_session_get_channel(session);
                                if (tech_pvt) {
                                        switch_mutex_lock(tech_pvt->sofia_mutex);
                                        locked = 1;
                                } else {
-                                       switch_core_session_rwunlock(session);
+                                       if (session != de->session) switch_core_session_rwunlock(session);
                                        return;
                                }
 
@@ -1111,7 +1111,7 @@ static void our_sofia_event_callback(nua_event_t event,
                switch_mutex_unlock(tech_pvt->sofia_mutex);
        }
 
-       if (session) {
+       if (session && session != de->session) {
                switch_core_session_rwunlock(session);
        }
 }