SS7Layer2 is now notifying its user on timer tick to avoid deadlocks. Make sure all descendents are calling SS7Layer2::timerTick().

git-svn-id: http://yate.null.ro/svn/yate/trunk@4481 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2011-07-12 09:17:08 +00:00
parent eae45ad032
commit df23b1edd2
4 changed files with 29 additions and 5 deletions

View File

@ -160,6 +160,19 @@ void SS7Layer2::attach(SS7L2User* l2user)
l2user->attach(this);
}
void SS7Layer2::timerTick(const Time& when)
{
SignallingComponent::timerTick(when);
m_l2userMutex.lock();
RefPointer<SS7L2User> tmp = m_notify ? m_l2user : 0;
m_notify = false;
m_l2userMutex.unlock();
if (tmp) {
XDebug(this,DebugAll,"SS7Layer2 notifying user [%p]",this);
tmp->notify(this);
}
}
void SS7Layer2::notify()
{
if (!operational())
@ -167,10 +180,8 @@ void SS7Layer2::notify()
else if (!m_lastUp)
m_lastUp = Time::secNow();
m_l2userMutex.lock();
RefPointer<SS7L2User> tmp = m_l2user;
m_notify = true;
m_l2userMutex.unlock();
if (tmp)
tmp->notify(this);
}
unsigned int SS7Layer2::status() const
@ -457,6 +468,7 @@ bool SS7MTP2::notify(SignallingInterface::Notification event)
void SS7MTP2::timerTick(const Time& when)
{
SS7Layer2::timerTick(when);
lock();
bool tout = m_interval && (when >= m_interval);
if (tout)

View File

@ -1049,6 +1049,7 @@ bool SS7M2PA::decodeSeq(const DataBlock& data,u_int8_t msgType)
void SS7M2PA::timerTick(const Time& when)
{
SS7Layer2::timerTick(when);
Lock lock(m_mutex);
if (m_confTimer.started() && m_confTimer.timeout(when.msec())) {
sendAck(); // Acknowledge last received message before endpoint drops down the link
@ -1681,6 +1682,7 @@ int SS7M2UA::getSequence()
void SS7M2UA::timerTick(const Time& when)
{
SS7Layer2::timerTick(when);
if (m_retrieve.timeout(when.msec())) {
m_retrieve.stop();
if (m_lastSeqRx == -2) {

View File

@ -5247,9 +5247,16 @@ protected:
inline SS7Layer2()
: m_autoEmergency(true), m_lastSeqRx(-1), m_congestion(0),
m_l2userMutex(true,"SS7Layer2::l2user"), m_l2user(0), m_sls(-1),
m_checkTime(0), m_checkFail(0), m_inhibited(Unchecked), m_lastUp(0)
m_checkTime(0), m_checkFail(0), m_inhibited(Unchecked), m_lastUp(0),
m_notify(false)
{ }
/**
* Method called periodically by the engine to keep everything alive
* @param when Time to use as computing base for events and timeouts
*/
virtual void timerTick(const Time& when);
/**
* Push a received Message Signal Unit up the protocol stack
* @param msu Message data, starting with Service Indicator Octet
@ -5277,7 +5284,8 @@ protected:
}
/**
* Notify out user part about a status change
* Set the notify flag.
* The user part will be notified on timer tick about status change
*/
void notify();
@ -5320,6 +5328,7 @@ private:
int m_checkFail;
int m_inhibited;
u_int32_t m_lastUp;
bool m_notify; // Notify on timer tick
};
/**

View File

@ -1746,6 +1746,7 @@ bool SLT::aligned() const
// if we don't receive it we resend the configuration request
void SLT::timerTick(const Time& when)
{
SS7Layer2::timerTick(when);
if (m_confReqTimer.timeout()) {
sendManagement(Configuration_R);
m_confReqTimer.stop();