Protected H.323 endpoint against concurrent creation of connections, the library is not thread safe when copying capabilities.

Should fix many crashes like: assert.cxx(108) PWLib Assertion fail: Invalid array index, file .../ptlib/contain.inl
Thanks to Michele Badaracchi for finding out the source of the problem.


git-svn-id: http://voip.null.ro/svn/yate@4241 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2011-03-30 17:17:30 +00:00
parent 677666e486
commit cf88bfdcb1
1 changed files with 5 additions and 3 deletions

View File

@ -255,7 +255,6 @@ public:
}; };
class YateGkRegThread; class YateGkRegThread;
class YateH323EndPoint;
class YateGatekeeperServer; class YateGatekeeperServer;
class YateH323EndPoint; class YateH323EndPoint;
class YateH323Chan; class YateH323Chan;
@ -358,7 +357,7 @@ private:
class YateH323_ExternalRTPChannel; class YateH323_ExternalRTPChannel;
class YateH323EndPoint : public String, public H323EndPoint class YateH323EndPoint : public String, public Mutex, public H323EndPoint
{ {
PCLASSINFO(YateH323EndPoint, H323EndPoint) PCLASSINFO(YateH323EndPoint, H323EndPoint)
public: public:
@ -720,8 +719,10 @@ BOOL YateGatekeeperServer::Init()
return TRUE; return TRUE;
} }
YateH323EndPoint::YateH323EndPoint(const NamedList* params, const char* name) YateH323EndPoint::YateH323EndPoint(const NamedList* params, const char* name)
: String(name), m_gkServer(0), m_thread(0), m_registered(false) : String(name), Mutex(false,"H323Endpoint"),
m_gkServer(0), m_thread(0), m_registered(false)
{ {
Debug(&hplugin,DebugAll,"YateH323EndPoint::YateH323EndPoint(%p,\"%s\") [%p]", Debug(&hplugin,DebugAll,"YateH323EndPoint::YateH323EndPoint(%p,\"%s\") [%p]",
params,name,this); params,name,this);
@ -770,6 +771,7 @@ H323Connection* YateH323EndPoint::CreateConnection(unsigned callReference,
Debug(DebugWarn,"Refusing new H.323 call, full or exiting"); Debug(DebugWarn,"Refusing new H.323 call, full or exiting");
return 0; return 0;
} }
Lock mylock(this);
return new YateH323Connection(*this,transport,callReference,userData); return new YateH323Connection(*this,transport,callReference,userData);
} }