1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-17 15:46:33 +09:00

Fixed problem with setting correct local address when we change DualStack property. Do not use any IPv6 features by default.

This commit is contained in:
Badartefact
2019-06-14 22:39:29 +03:00
parent 37cd6ac2c3
commit b9bfbb0be5
3 changed files with 14 additions and 5 deletions

View File

@@ -95,7 +95,7 @@ namespace Lidgren.Network
//
m_disabledTypes = NetIncomingMessageType.ConnectionApproval | NetIncomingMessageType.UnconnectedData | NetIncomingMessageType.VerboseDebugMessage | NetIncomingMessageType.ConnectionLatencyUpdated | NetIncomingMessageType.NatIntroductionSuccess;
m_networkThreadName = "Lidgren network thread";
m_localAddress = IPAddress.IPv6Any;
m_localAddress = IPAddress.Any;
m_broadcastAddress = IPAddress.Broadcast;
var ip = NetUtility.GetBroadcastAddress();
if (ip != null)
@@ -330,7 +330,7 @@ namespace Lidgren.Network
}
/// <summary>
/// Gets or sets the local ip address to bind to. Defaults to IPAddress.IPv6Any. Cannot be changed once NetPeer is initialized.
/// Gets or sets the local ip address to bind to. Defaults to IPAddress.Any. Cannot be changed once NetPeer is initialized.
/// </summary>
public IPAddress LocalAddress
{
@@ -353,7 +353,11 @@ namespace Lidgren.Network
{
if (m_isLocked)
throw new NetException(c_isLockedMessage);
m_dualStack = value;
m_dualStack = value;
if (m_dualStack && m_localAddress.Equals(IPAddress.Any))
m_localAddress = IPAddress.IPv6Any;
if (!m_dualStack && m_localAddress.Equals(IPAddress.IPv6Any))
m_localAddress = IPAddress.Any;
}
}