Changed: Minor changes

--HG--
branch : develop
This commit is contained in:
kervala 2016-04-02 13:29:42 +02:00
parent a410f2fcc1
commit c30bf20ccc
2 changed files with 28 additions and 18 deletions

View file

@ -730,7 +730,8 @@ std::vector<CInetAddress> CInetAddress::localAddresses()
while (p != NULL)
{
// check address family
if (p->ai_family == AF_INET){ // ipv4
if (p->ai_family == AF_INET)
{
// loopback ipv4
if(!psin_addrIPv4){ // add loopback address only once
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 ) );
}
else if (p->ai_family == AF_INET6){ // ipv6
else if (p->ai_family == AF_INET6)
{
// loopback ipv6
if(!psin_addrIPv6){ // add loopback address only once
struct in6_addr aLoopback6 = IN6ADDR_LOOPBACK_INIT;

View file

@ -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(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 ());
}
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
//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
} else {
if(nid == 0xFF){
}
else
{
if (nid == 0xFF)
{
_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 ());
break;
}