Return pending and outgoing events of all transactions before trying to create new ones.

git-svn-id: http://voip.null.ro/svn/yate@1515 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2007-11-30 16:46:06 +00:00
parent 9ad1d5fa28
commit 7366b0ff87
3 changed files with 18 additions and 3 deletions

View File

@ -260,7 +260,18 @@ SIPEvent* SIPEngine::getEvent()
for (; l; l = l->next()) {
SIPTransaction* t = static_cast<SIPTransaction*>(l->get());
if (t) {
SIPEvent* e = t->getEvent();
SIPEvent* e = t->getEvent(true);
if (e) {
DDebug(this,DebugInfo,"Got pending event %p (state %s) from transaction %p [%p]",
e,SIPTransaction::stateName(e->getState()),t,this);
return e;
}
}
}
for (l = &TransList; l; l = l->next()) {
SIPTransaction* t = static_cast<SIPTransaction*>(l->get());
if (t) {
SIPEvent* e = t->getEvent(false);
if (e) {
DDebug(this,DebugInfo,"Got event %p (state %s) from transaction %p [%p]",
e,SIPTransaction::stateName(e->getState()),t,this);

View File

@ -242,7 +242,7 @@ void SIPTransaction::setTimeout(u_int64_t delay, unsigned int count)
#endif
}
SIPEvent* SIPTransaction::getEvent()
SIPEvent* SIPTransaction::getEvent(bool pendingOnly)
{
SIPEvent *e = 0;
@ -257,6 +257,9 @@ SIPEvent* SIPTransaction::getEvent()
return new SIPEvent(m_lastMessage ? m_lastMessage : m_firstMessage,this);
}
if (pendingOnly)
return 0;
int timeout = -1;
if (m_timeout && (Time::now() >= m_timeout)) {
timeout = --m_timeouts;

View File

@ -673,9 +673,10 @@ public:
* It provides default handling for invalid states, otherwise calls
* the more specific protected version.
* You may override this method if you need processing of invalid states.
* @param pendingOnly True to only return outgoing and pending events
* @return A newly allocated event or NULL if none is needed
*/
virtual SIPEvent* getEvent();
virtual SIPEvent* getEvent(bool pendingOnly = false);
/**
* Creates and transmits a final response message