Network: Add support for dual-stack sockets
This commit is contained in:
@@ -156,6 +156,7 @@ namespace Nz
|
||||
UInt64 m_totalReceivedData;
|
||||
bool m_allowsIncomingConnections;
|
||||
bool m_continueSending;
|
||||
bool m_isUsingDualStack;
|
||||
bool m_isSimulationEnabled;
|
||||
bool m_recalculateBandwidthLimits;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Nz
|
||||
{
|
||||
inline ENetHost::ENetHost() :
|
||||
m_packetPool(sizeof(ENetPacket)),
|
||||
m_isUsingDualStack(false),
|
||||
m_isSimulationEnabled(false)
|
||||
{
|
||||
}
|
||||
@@ -20,21 +21,22 @@ namespace Nz
|
||||
|
||||
inline bool ENetHost::Create(NetProtocol protocol, UInt16 port, std::size_t peerCount, std::size_t channelCount)
|
||||
{
|
||||
NazaraAssert(protocol != NetProtocol_Any, "Any protocol not supported for Listen"); //< TODO
|
||||
NazaraAssert(protocol != NetProtocol_Unknown, "Invalid protocol");
|
||||
|
||||
IpAddress any;
|
||||
switch (protocol)
|
||||
{
|
||||
case NetProtocol_Any:
|
||||
case NetProtocol_Unknown:
|
||||
NazaraInternalError("Invalid protocol Any at this point");
|
||||
NazaraInternalError("Invalid protocol");
|
||||
return false;
|
||||
|
||||
case NetProtocol_IPv4:
|
||||
any = IpAddress::AnyIpV4;
|
||||
break;
|
||||
|
||||
case NetProtocol_Any:
|
||||
m_isUsingDualStack = true;
|
||||
// fallthrough
|
||||
case NetProtocol_IPv6:
|
||||
any = IpAddress::AnyIpV6;
|
||||
break;
|
||||
|
||||
@@ -51,15 +51,15 @@ namespace Nz
|
||||
IpAddress any;
|
||||
switch (m_protocol)
|
||||
{
|
||||
case NetProtocol_Any:
|
||||
case NetProtocol_Unknown:
|
||||
NazaraInternalError("Invalid protocol Any at this point");
|
||||
NazaraInternalError("Invalid protocol");
|
||||
return SocketState_NotConnected;
|
||||
|
||||
case NetProtocol_IPv4:
|
||||
any = IpAddress::AnyIpV4;
|
||||
break;
|
||||
|
||||
case NetProtocol_Any:
|
||||
case NetProtocol_IPv6:
|
||||
any = IpAddress::AnyIpV6;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user