mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-15 08:29:45 +00:00
fix crashes on FSH323Connection calls in on_hangup routine in different threads.
This commit is contained in:
parent
94cf078a4d
commit
19dc1ab0f2
@ -1,3 +1,4 @@
|
||||
fix crashes on FSH323Connection calls in on_hangup routine in different threads.
|
||||
move PTrace level set to FSH323EndPoint::Initialise
|
||||
partially apply patch from from Peter Olsson, Remove UnLock() when TryLock() failed and DEBUG_RTP_PACKETS directive.
|
||||
apply changes from mod_h323-patch.diff by Peter Olsson.
|
||||
|
@ -24,7 +24,7 @@
|
||||
*
|
||||
* mod_h323.cpp -- H323 endpoint
|
||||
*
|
||||
* Version 0.0.55
|
||||
* Version 0.0.56
|
||||
*/
|
||||
|
||||
//#define DEBUG_RTP_PACKETS
|
||||
@ -747,6 +747,17 @@ FSH323Connection::~FSH323Connection()
|
||||
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n");
|
||||
}
|
||||
|
||||
void FSH323Connection::AttachSignalChannel(const PString & token,
|
||||
H323Transport * channel,
|
||||
PBoolean answeringCall)
|
||||
{
|
||||
h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession);
|
||||
tech_pvt->token = strdup((const char *)token);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"---------->token = %s [%p]\n",(const char *)token,this);
|
||||
H323Connection::AttachSignalChannel(token,channel,answeringCall);
|
||||
}
|
||||
|
||||
|
||||
void FSH323Connection::OnSetLocalCapabilities()
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnSetLocalCapabilities() [%p]\n",this);
|
||||
@ -2321,8 +2332,9 @@ static switch_status_t on_hangup(switch_core_session_t *session)
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(session);
|
||||
FSH323Connection *me = tech_pvt->me;
|
||||
FSH323EndPoint & ep = h323_process->GetH323EndPoint();
|
||||
tech_pvt->me = NULL;
|
||||
|
||||
|
||||
if (me) {
|
||||
if (me->m_rtp_resetting == 1) {
|
||||
switch_core_session_unlock_codec_read(session);
|
||||
@ -2340,12 +2352,12 @@ static switch_status_t on_hangup(switch_core_session_t *session)
|
||||
me->CloseAllLogicalChannels(false);
|
||||
me->Unlock();
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----->%s\n",(const char *)(me->GetCallToken()));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----->%s\n",(const char *)(tech_pvt->token));
|
||||
Q931::CauseValues cause = (Q931::CauseValues)switch_channel_get_cause_q850(channel);
|
||||
int trylock = me->TryLock();
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-----> () = %d\n",trylock);
|
||||
if (trylock == 1) {
|
||||
const PString currentToken(me->GetCallToken());
|
||||
const PString currentToken(tech_pvt->token);
|
||||
FSH323Connection *connection = (FSH323Connection *)me->GetEndPoint()->FindConnectionWithLock(currentToken);
|
||||
if (connection) {
|
||||
connection->Unlock();
|
||||
@ -2356,8 +2368,10 @@ static switch_status_t on_hangup(switch_core_session_t *session)
|
||||
} else if (trylock == -1) {
|
||||
/* Failed to lock - just go on */
|
||||
}
|
||||
const PString currentToken(tech_pvt->token);
|
||||
me->SetQ931Cause(cause);
|
||||
me->ClearCallSynchronous(NULL, H323TranslateToCallEndReason(cause, UINT_MAX));
|
||||
// me->ClearCallSynchronous(NULL, H323TranslateToCallEndReason(cause, UINT_MAX));
|
||||
ep.ClearCall(currentToken, H323TranslateToCallEndReason(cause, UINT_MAX));
|
||||
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_lock\n");
|
||||
// switch_mutex_lock(tech_pvt->h323_mutex);
|
||||
}
|
||||
|
@ -184,6 +184,7 @@ typedef struct {
|
||||
switch_mutex_t *h323_io_mutex;
|
||||
|
||||
FSH323Connection *me;
|
||||
char *token;
|
||||
} h323_private_t;
|
||||
|
||||
#define DECLARE_CALLBACK0(name) \
|
||||
@ -306,7 +307,11 @@ class FSH323Connection:public H323Connection {
|
||||
unsigned callReference, switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t *fsSession, switch_channel_t *fsChannel);
|
||||
~FSH323Connection();
|
||||
|
||||
virtual void AttachSignalChannel(
|
||||
const PString & token,
|
||||
H323Transport * channel,
|
||||
PBoolean answeringCall
|
||||
);
|
||||
virtual H323Channel *CreateRealTimeLogicalChannel(const H323Capability & capability,
|
||||
H323Channel::Directions dir,
|
||||
unsigned sessionID, const H245_H2250LogicalChannelParameters * param, RTP_QOS * rtpqos = NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user