]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix race condition on destroying signaling thread in h323 library
authorGeorgiewskiy Yuriy <bottleman@icf.org.ru>
Fri, 22 Apr 2011 11:19:27 +0000 (15:19 +0400)
committerGeorgiewskiy Yuriy <bottleman@icf.org.ru>
Fri, 22 Apr 2011 11:19:27 +0000 (15:19 +0400)
src/mod/endpoints/mod_h323/changes.txt
src/mod/endpoints/mod_h323/mod_h323.cpp
src/mod/endpoints/mod_h323/mod_h323.h

index 4f75aef8b4b5d01b2b0620f0070c0a9efaea4f10..3af956f0cb0d31623c1ef9d9f0d734f9ad4cf77a 100644 (file)
@@ -1,3 +1,4 @@
+fix race condition on destroying signaling thread in h323 library
 Adds an extra switch_rtp_destroy or switch_rtp_release_port when a session ends 
     - to make sure the port is returned to FS. thx to Peter Olsson.
 fix issues with Progress message type if pre_answer enabled
index 44295f618f9b19c8218b349357a76b3a570701a8..233e972e32115bab64a1daa4405d7aac5f006558 100644 (file)
@@ -1,9 +1,12 @@
 /* 
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
+ * H323 endpoint interface for Freeswitch Modular Media Switching Software Library /
+ * Soft-Switch Application
  *
  * Version: MPL 1.1
  *
+ * Copyright (c) 2010 Ilnitskiy Mixim (max.h323@gmail.com)
+ * Copyright (c) 2010 Georgiewskiy Yuriy (bottleman@icf.org.ru)
+ *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * for the specific language governing rights and limitations under the
  * License.
  *
+ * Contributor(s):
+ * 
+ * 
+ * 
+ *
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
@@ -24,7 +32,7 @@
  *
  * mod_h323.cpp -- H323 endpoint
  *
- *     Version 0.0.56
+ *     Version 0.0.57
 */
 
 //#define DEBUG_RTP_PACKETS
@@ -708,6 +716,7 @@ FSH323Connection::FSH323Connection(FSH323EndPoint& endpoint, H323Transport* tran
 
        h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt));
        tech_pvt->me = this;
+       tech_pvt->active_connection = true;
        switch_core_session_set_private(m_fsSession, tech_pvt);
        
        switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession));
@@ -748,8 +757,9 @@ FSH323Connection::~FSH323Connection()
        } else if (m_RTPlocalPort) {
                switch_rtp_release_port((const char *)m_RTPlocalIP.AsString(), m_RTPlocalPort);
        }
-
+       
        tech_pvt->me = NULL;
+       tech_pvt->active_connection = false;
 //     switch_mutex_unlock(tech_pvt->h323_mutex);
 //     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
 }      
@@ -2387,6 +2397,9 @@ static switch_status_t on_hangup(switch_core_session_t *session)
        switch_mutex_lock(tech_pvt->h323_mutex);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
        switch_mutex_unlock(tech_pvt->h323_mutex);
-
+       while (tech_pvt->active_connection){
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Wait clear h323 connection\n");
+               h_timer(1);
+       }
        return SWITCH_STATUS_SUCCESS;
 }
index 5477f9aa59bdc821ba16759655bab055858de39a..3a0d7aa2356ba8b808ac518ffd51f9329dfb50db 100644 (file)
@@ -1,9 +1,12 @@
 /* 
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
+ * H323 endpoint interface for Freeswitch Modular Media Switching Software Library /
+ * Soft-Switch Application
  *
  * Version: MPL 1.1
  *
+ * Copyright (c) 2010 Ilnitskiy Mixim (max.h323@gmail.com)
+ * Copyright (c) 2010 Georgiewskiy Yuriy (bottleman@icf.org.ru)
+ *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * for the specific language governing rights and limitations under the
  * License.
  *
+ * Contributor(s):
+ * 
+ * 
+ * 
+ *
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * The Initial Developer of the Original Code is
@@ -24,7 +32,8 @@
  *
  * mod_h323.h -- H323 endpoint
  *
- */
+ *     Version 0.0.57
+*/
 
 #if defined(__GNUC__) && defined(HAVE_VISIBILITY)
 #pragma GCC visibility push(default)
@@ -184,6 +193,7 @@ typedef struct {
        switch_mutex_t *h323_io_mutex;
 
        FSH323Connection *me;
+       bool                    active_connection;
        char                    *token;
 } h323_private_t;