Removed stream cleanup stream. Now the engine is using an iterator to terminate all streams at cleanup.
git-svn-id: http://voip.null.ro/svn/yate@1729 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
8062d574b2
commit
1133f1238e
|
@ -402,10 +402,11 @@ void JBEngine::initialize(const NamedList& params)
|
||||||
void JBEngine::cleanup()
|
void JBEngine::cleanup()
|
||||||
{
|
{
|
||||||
Lock lock(this);
|
Lock lock(this);
|
||||||
for (ObjList* o = m_streams.skipNull(); o; o = o->skipNext()) {
|
// Use an iterator: the stream might be destroyed when terminating
|
||||||
JBStream* s = static_cast<JBStream*>(o->get());
|
ListIterator iter(m_streams);
|
||||||
|
for (GenObject* o = 0; 0 != (o = iter.get());) {
|
||||||
|
JBStream* s = static_cast<JBStream*>(o);
|
||||||
s->terminate(true,0,XMPPError::Shutdown,0,true);
|
s->terminate(true,0,XMPPError::Shutdown,0,true);
|
||||||
s->cleanup();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -475,6 +475,7 @@ void JBStream::terminate(bool destroy, XMLElement* recvStanza, XMPPError::Type e
|
||||||
const char* reason, bool send, bool final)
|
const char* reason, bool send, bool final)
|
||||||
{
|
{
|
||||||
Lock2 lock(m_socket.m_streamMutex,m_socket.m_receiveMutex);
|
Lock2 lock(m_socket.m_streamMutex,m_socket.m_receiveMutex);
|
||||||
|
TelEngine::destruct(m_startEvent);
|
||||||
if (state() == Destroy) {
|
if (state() == Destroy) {
|
||||||
if (recvStanza)
|
if (recvStanza)
|
||||||
delete recvStanza;
|
delete recvStanza;
|
||||||
|
@ -520,7 +521,6 @@ void JBStream::terminate(bool destroy, XMLElement* recvStanza, XMPPError::Type e
|
||||||
// Cancel all outgoing elements without id
|
// Cancel all outgoing elements without id
|
||||||
removePending(false,0,true);
|
removePending(false,0,true);
|
||||||
// Always set termination event, except when exiting
|
// Always set termination event, except when exiting
|
||||||
TelEngine::destruct(m_startEvent);
|
|
||||||
if (!(m_terminateEvent || m_engine->exiting())) {
|
if (!(m_terminateEvent || m_engine->exiting())) {
|
||||||
if (!recvStanza && error != XMPPError::NoError)
|
if (!recvStanza && error != XMPPError::NoError)
|
||||||
recvStanza = XMPPUtils::createStreamError(error,reason);
|
recvStanza = XMPPUtils::createStreamError(error,reason);
|
||||||
|
|
|
@ -475,17 +475,6 @@ public:
|
||||||
removePending(notify,&id,false);
|
removePending(notify,&id,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Cleanup the stream before destroying
|
|
||||||
* This method is thread safe
|
|
||||||
*/
|
|
||||||
inline void cleanup() {
|
|
||||||
Lock lock(m_socket.m_streamMutex);
|
|
||||||
m_events.clear();
|
|
||||||
TelEngine::destruct(m_terminateEvent);
|
|
||||||
TelEngine::destruct(m_startEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of a stream state
|
* Get the name of a stream state
|
||||||
* @param state The requested state number
|
* @param state The requested state number
|
||||||
|
|
Loading…
Reference in New Issue