Changed: Minor changes

This commit is contained in:
kervala 2016-04-02 13:29:42 +02:00
parent a445afef3c
commit e2073f31d7
2 changed files with 28 additions and 18 deletions

View file

@ -92,18 +92,18 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
BOOLEAN IN6_IS_ADDR_UNSPECIFIED(CONST IN6_ADDR *a)
{
//
// We can't use the in6addr_any variable, since that would
// require existing callers to link with a specific library.
//
return (BOOLEAN)((a->s6_words[0] == 0) &&
(a->s6_words[1] == 0) &&
(a->s6_words[2] == 0) &&
(a->s6_words[3] == 0) &&
(a->s6_words[4] == 0) &&
(a->s6_words[5] == 0) &&
(a->s6_words[6] == 0) &&
(a->s6_words[7] == 0));
//
// We can't use the in6addr_any variable, since that would
// require existing callers to link with a specific library.
//
return (BOOLEAN)((a->s6_words[0] == 0) &&
(a->s6_words[1] == 0) &&
(a->s6_words[2] == 0) &&
(a->s6_words[3] == 0) &&
(a->s6_words[4] == 0) &&
(a->s6_words[5] == 0) &&
(a->s6_words[6] == 0) &&
(a->s6_words[7] == 0));
}
#endif
@ -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;
}