Reset endpoint pointer when terminated to avoid using it.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6251 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2017-08-02 07:51:02 +00:00
parent c4c9e994f0
commit 0025edce41
1 changed files with 15 additions and 2 deletions

View File

@ -1135,6 +1135,7 @@ public:
{ return m_endpoint; }
inline SDPParser& parser()
{ return m_parser; }
void epTerminated(YateSIPEndPoint* ep);
YateSIPConnection* findCall(const String& callid, bool incRef = false);
YateSIPConnection* findDialog(const SIPDialog& dialog, bool incRef = false);
YateSIPConnection* findDialog(const String& dialog, const String& fromTag,
@ -4795,6 +4796,7 @@ YateSIPEndPoint::~YateSIPEndPoint()
m_engine = 0;
}
m_defTransport = 0;
plugin.epTerminated(this);
}
bool YateSIPEndPoint::buildParty(SIPMessage* message, const char* host, int port, const YateSIPLine* line)
@ -5295,11 +5297,14 @@ void YateSIPEndPoint::run()
break;
}
}
if (s_evCount || s_engineHalt)
Thread::check();
if (s_evCount || s_engineHalt) {
if (Thread::check(false))
break;
}
else
Thread::usleep(Thread::idleUsec());
}
plugin.epTerminated(this);
}
bool YateSIPEndPoint::incoming(SIPEvent* e, SIPTransaction* t)
@ -8805,6 +8810,14 @@ bool SipHandler::received(Message &msg)
}
void SIPDriver::epTerminated(YateSIPEndPoint* ep)
{
if (!(ep && ep == m_endpoint))
return;
Debug(this,s_engineHalt ? DebugAll : DebugWarn,"Endpoint stopped");
m_endpoint = 0;
}
YateSIPConnection* SIPDriver::findCall(const String& callid, bool incRef)
{
XDebug(this,DebugAll,"SIPDriver finding call '%s'",callid.c_str());