1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-06 02:11:06 +09:00

Fixed m_connectionLookup was not cleared on shutdown

This commit is contained in:
lidgren
2012-12-18 08:30:08 +00:00
parent 44971f0afc
commit bf2987b168

View File

@@ -24,7 +24,7 @@ namespace Lidgren.Network
private object m_initializeLock = new object();
private uint m_frameCounter;
private double m_lastHeartbeat;
private NetUPnP m_upnp;
private NetPortForwarding m_portForwarding;
internal readonly NetPeerConfiguration m_configuration;
private readonly NetQueue<NetIncomingMessage> m_releasedIncomingMessages;
@@ -99,8 +99,8 @@ namespace Lidgren.Network
if (m_status == NetPeerStatus.Running)
return;
if (m_configuration.m_enableUPnP)
m_upnp = new NetUPnP(this);
if (m_configuration.m_enablePortForwarding)
m_portForwarding = new NetPortForwarding(this);
InitializePools();
@@ -264,6 +264,7 @@ namespace Lidgren.Network
m_sendBuffer = null;
m_unsentUnconnectedMessages.Clear();
m_connections.Clear();
m_connectionLookup.Clear();
m_handshakes.Clear();
}
@@ -402,22 +403,8 @@ namespace Lidgren.Network
IPEndPoint ipsender = (IPEndPoint)m_senderRemote;
if (m_upnp != null && now < m_upnp.m_discoveryResponseDeadline)
{
// is this an UPnP response?
try
{
string resp = System.Text.Encoding.ASCII.GetString(m_receiveBuffer, 0, bytesReceived);
if (resp.Contains("upnp:rootdevice") || resp.Contains("UPnP/1.0"))
{
resp = resp.Substring(resp.ToLower().IndexOf("location:") + 9);
resp = resp.Substring(0, resp.IndexOf("\r")).Trim();
m_upnp.ExtractServiceUrl(resp);
return;
}
}
catch { }
}
if (m_portForwarding != null && m_portForwarding.IsDiscovering)
m_portForwarding.HandlePotentialDiscovery(ipsender, m_receiveBuffer, bytesReceived);
NetConnection sender = null;
m_connectionLookup.TryGetValue(ipsender, out sender);