Implemented load sharing between linksets.

git-svn-id: http://voip.null.ro/svn/yate@3617 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2010-09-01 08:10:34 +00:00
parent 7023dcca5a
commit 30d87dd382
2 changed files with 15 additions and 25 deletions

View File

@ -93,7 +93,6 @@ void SS7Route::attach(SS7Layer3* network, SS7PointCode::Type type)
if (priority == (unsigned int)-1)
return;
Lock lock(this);
m_changes++;
// Remove from list if already there
detach(network);
// Insert
@ -123,7 +122,6 @@ bool SS7Route::detach(SS7Layer3* network)
for (; o; o = o->skipNext()) {
L3Pointer* p = static_cast<L3Pointer*>(o->get());
if (*p && *p == network) {
m_changes++;
m_networks.remove(p,false);
break;
}
@ -175,26 +173,19 @@ int SS7Route::transmitMSU(const SS7Router* router, const SS7MSU& msu,
const SS7Label& label, int sls, const SS7Layer3* source)
{
lock();
ObjList* o;
do {
for (o = m_networks.skipNull(); o; o = o->skipNext()) {
L3Pointer* p = static_cast<L3Pointer*>(o->get());
RefPointer<SS7Layer3> l3 = static_cast<SS7Layer3*>(*p);
if (!l3 || (source == l3))
continue;
XDebug(router,DebugAll,"Attempting transmitMSU on L3=%p '%s' [%p]",
(void*)l3,l3->toString().c_str(),router);
int chg = m_changes;
unlock();
int res = l3->transmitMSU(msu,label,sls);
if (res != -1)
return res;
lock();
// if list has changed break with o not null so repeat the scan
if (chg != m_changes)
break;
}
} while (o);
ListIterator iter(m_networks,sls >> shift());
while (L3Pointer* p = static_cast<L3Pointer*>(iter.get())) {
RefPointer<SS7Layer3> l3 = static_cast<SS7Layer3*>(*p);
if (!l3)
continue;
unlock();
XDebug(router,DebugAll,"Attempting transmitMSU on L3=%p '%s' [%p]",
(void*)l3,l3->toString().c_str(),router);
int res = l3->transmitMSU(msu,label,sls);
if (res != -1)
return res;
lock();
}
unlock();
return -1;
}

View File

@ -5234,7 +5234,7 @@ public:
inline SS7Route(unsigned int packed, unsigned int priority = 0, unsigned int shift = 0)
: Mutex(true,"SS7Route"),
m_packed(packed), m_priority(priority), m_shift(shift),
m_state(Unknown), m_changes(0)
m_state(Unknown)
{ m_networks.setDelete(false); }
/**
@ -5244,7 +5244,7 @@ public:
inline SS7Route(const SS7Route& original)
: Mutex(true,"SS7Route"),
m_packed(original.packed()), m_priority(original.priority()),
m_shift(original.shift()), m_state(original.state()), m_changes(0)
m_shift(original.shift()), m_state(original.state())
{ m_networks.setDelete(false); }
/**
@ -5349,7 +5349,6 @@ private:
unsigned int m_shift; // SLS right shift when selecting linkset
ObjList m_networks; // List of networks used to route to the given destination (used by SS7Router)
State m_state; // State of the route
int m_changes; // Counter used to spot changes in the list
};
/**