Improve "unexpected address family" asserts

alut-include-path
Lukas Werling 2017-01-10 18:27:21 +01:00
parent efe0b134ef
commit 890deb997d
3 changed files with 7 additions and 4 deletions

View File

@ -76,7 +76,8 @@ namespace std {
auto unpack = make_tuple(v6.sin6_family, v6.sin6_port, v6.sin6_flowinfo, std::string((char*) v6.sin6_addr.s6_addr, 16), v6.sin6_scope_id);
return hash<decltype(unpack)>()(unpack);
}
default:
case C4NetIO::HostAddress::UnknownFamily:
assert(!"Unexpected address family");
return 0;
}
}

View File

@ -948,8 +948,10 @@ C4NetpuncherID::value& C4Network2::getNetpuncherGameID(C4NetIO::HostAddress::Add
{
case C4NetIO::HostAddress::IPv4: return NetpuncherGameID.v4;
case C4NetIO::HostAddress::IPv6: return NetpuncherGameID.v6;
default: assert(false);
case C4NetIO::HostAddress::UnknownFamily: assert(!"Unexpected address family");
}
// We need to return a valid reference to satisfy the compiler, even though the code here is unreachable.
return NetpuncherGameID.v4;
}
void C4Network2::InitPuncher()

View File

@ -468,8 +468,8 @@ bool C4Network2IO::InitPuncher(C4NetIO::addr_t nPuncherAddr)
case C4NetIO::HostAddress::IPv6:
PuncherAddrIPv6 = nPuncherAddr;
break;
default:
assert(false);
case C4NetIO::HostAddress::UnknownFamily:
assert(!"Unexpected address family");
}
// let's punch
return pNetIO_UDP->Connect(nPuncherAddr);