Process transaction in sender's thread when synchronously sending a command to avoid blocking the engine private process thread.

git-svn-id: http://yate.null.ro/svn/yate/trunk@5364 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2012-12-18 15:32:20 +00:00
parent a5857bd1d8
commit 5a3e68901b
1 changed files with 14 additions and 4 deletions

View File

@ -722,13 +722,18 @@ RefPointer<MGCPMessage> MGCPWrapper::sendSync(MGCPMessage* mm, const SocketAddr&
Thread::idle();
}
u_int64_t t2 = Time::msecNow();
MGCPTransaction* tr = s_engine->sendCommand(mm,address);
RefPointer<MGCPTransaction> tr = s_engine->sendCommand(mm,address,false);
s_mutex.lock();
tr->userData(m_this);
m_tr = tr;
s_mutex.unlock();
while (m_tr == tr)
while (m_tr == tr) {
Thread::idle();
s_engine->processTransaction(tr);
}
if (tr)
tr->setEngineProcess();
tr = 0;
RefPointer<MGCPMessage> tmp = m_msg;
m_msg = 0;
u_int64_t t3 = Time::msecNow();
@ -1628,13 +1633,18 @@ RefPointer<MGCPMessage> MGCPCircuit::sendSync(MGCPMessage* mm)
Thread::idle();
}
u_int64_t t2 = Time::msecNow();
MGCPTransaction* tr = s_engine->sendCommand(mm,ep->address());
RefPointer<MGCPTransaction> tr = s_engine->sendCommand(mm,ep->address(),false);
s_mutex.lock();
tr->userData(m_this);
m_tr = tr;
s_mutex.unlock();
while (m_tr == tr)
while (m_tr == tr) {
Thread::idle();
s_engine->processTransaction(tr);
}
if (tr)
tr->setEngineProcess();
tr = 0;
RefPointer<MGCPMessage> tmp = m_msg;
m_msg = 0;
u_int64_t t3 = Time::msecNow();