Changed: Minor changes
This commit is contained in:
parent
a445afef3c
commit
e2073f31d7
2 changed files with 28 additions and 18 deletions
|
@ -730,7 +730,8 @@ std::vector<CInetAddress> CInetAddress::localAddresses()
|
||||||
while (p != NULL)
|
while (p != NULL)
|
||||||
{
|
{
|
||||||
// check address family
|
// check address family
|
||||||
if (p->ai_family == AF_INET){ // ipv4
|
if (p->ai_family == AF_INET)
|
||||||
|
{
|
||||||
// loopback ipv4
|
// loopback ipv4
|
||||||
if(!psin_addrIPv4){ // add loopback address only once
|
if(!psin_addrIPv4){ // add loopback address only once
|
||||||
struct in_addr *psin_addrIPv4 = new in_addr;
|
struct in_addr *psin_addrIPv4 = new in_addr;
|
||||||
|
@ -743,7 +744,8 @@ std::vector<CInetAddress> CInetAddress::localAddresses()
|
||||||
vect.push_back( CInetAddress( &ipv4->sin_addr, localhost ) );
|
vect.push_back( CInetAddress( &ipv4->sin_addr, localhost ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (p->ai_family == AF_INET6){ // ipv6
|
else if (p->ai_family == AF_INET6)
|
||||||
|
{
|
||||||
// loopback ipv6
|
// loopback ipv6
|
||||||
if(!psin_addrIPv6){ // add loopback address only once
|
if(!psin_addrIPv6){ // add loopback address only once
|
||||||
struct in6_addr aLoopback6 = IN6ADDR_LOOPBACK_INIT;
|
struct in6_addr aLoopback6 = IN6ADDR_LOOPBACK_INIT;
|
||||||
|
|
|
@ -1294,8 +1294,11 @@ uint8 CUnifiedNetwork::findConnectionId (TServiceId sid, uint8 nid)
|
||||||
if (connectionId >= _IdCnx[sid.get()].Connections.size() || !_IdCnx[sid.get()].Connections[connectionId].valid() || !_IdCnx[sid.get()].Connections[connectionId].CbNetBase->connected())
|
if (connectionId >= _IdCnx[sid.get()].Connections.size() || !_IdCnx[sid.get()].Connections[connectionId].valid() || !_IdCnx[sid.get()].Connections[connectionId].CbNetBase->connected())
|
||||||
{
|
{
|
||||||
|
|
||||||
if(nid != 0xFF) // not a default network. There's a problem with the selected connectionID, so try to find a valid one
|
if (nid != 0xFF)
|
||||||
|
{
|
||||||
|
// not a default network. There's a problem with the selected connectionID, so try to find a valid one
|
||||||
nlwarning ("HNETL5: Can't find selected connection id %hu to send message to %s because connection is not valid or connected, find a valid connection id", (uint16)connectionId, _IdCnx[sid.get()].ServiceName.c_str ());
|
nlwarning ("HNETL5: Can't find selected connection id %hu to send message to %s because connection is not valid or connected, find a valid connection id", (uint16)connectionId, _IdCnx[sid.get()].ServiceName.c_str ());
|
||||||
|
}
|
||||||
|
|
||||||
for (connectionId = 0; connectionId < _IdCnx[sid.get()].Connections.size(); connectionId++)
|
for (connectionId = 0; connectionId < _IdCnx[sid.get()].Connections.size(); connectionId++)
|
||||||
{
|
{
|
||||||
|
@ -1303,13 +1306,18 @@ uint8 CUnifiedNetwork::findConnectionId (TServiceId sid, uint8 nid)
|
||||||
{
|
{
|
||||||
// we found one at last, use this one
|
// we found one at last, use this one
|
||||||
//nldebug ("HNETL5: Ok, we found a valid connectionid, use %hu", (uint16)connectionId);
|
//nldebug ("HNETL5: Ok, we found a valid connectionid, use %hu", (uint16)connectionId);
|
||||||
if(nid < _IdCnx[sid.get()].NetworkConnectionAssociations.size()){
|
if (nid < _IdCnx[sid.get()].NetworkConnectionAssociations.size())
|
||||||
|
{
|
||||||
_IdCnx[sid.get()].NetworkConnectionAssociations[nid] = connectionId; // we set the preferred networkConnectionAssociation
|
_IdCnx[sid.get()].NetworkConnectionAssociations[nid] = connectionId; // we set the preferred networkConnectionAssociation
|
||||||
} else {
|
}
|
||||||
if(nid == 0xFF){
|
else
|
||||||
|
{
|
||||||
|
if (nid == 0xFF)
|
||||||
|
{
|
||||||
_IdCnx[sid.get()].DefaultNetwork = connectionId;
|
_IdCnx[sid.get()].DefaultNetwork = connectionId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nlwarning ("HNETL5: selected connection id %hu from network %hu to send message to %s", (uint16)connectionId, (uint16)nid, _IdCnx[sid.get()].ServiceName.c_str ());
|
nlwarning ("HNETL5: selected connection id %hu from network %hu to send message to %s", (uint16)connectionId, (uint16)nid, _IdCnx[sid.get()].ServiceName.c_str ());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue