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

- Ugh, got halfcreated file in last checkin; reverted

This commit is contained in:
lidgren
2012-12-18 08:45:51 +00:00
parent bf2987b168
commit 5798c84406

View File

@@ -24,8 +24,8 @@ namespace Lidgren.Network
private object m_initializeLock = new object();
private uint m_frameCounter;
private double m_lastHeartbeat;
private NetPortForwarding m_portForwarding;
private NetUPnP m_upnp;
internal readonly NetPeerConfiguration m_configuration;
private readonly NetQueue<NetIncomingMessage> m_releasedIncomingMessages;
internal readonly NetQueue<NetTuple<IPEndPoint, NetOutgoingMessage>> m_unsentUnconnectedMessages;
@@ -99,8 +99,8 @@ namespace Lidgren.Network
if (m_status == NetPeerStatus.Running)
return;
if (m_configuration.m_enablePortForwarding)
m_portForwarding = new NetPortForwarding(this);
if (m_configuration.m_enableUPnP)
m_upnp = new NetUPnP(this);
InitializePools();
@@ -403,8 +403,22 @@ namespace Lidgren.Network
IPEndPoint ipsender = (IPEndPoint)m_senderRemote;
if (m_portForwarding != null && m_portForwarding.IsDiscovering)
m_portForwarding.HandlePotentialDiscovery(ipsender, m_receiveBuffer, bytesReceived);
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 { }
}
NetConnection sender = null;
m_connectionLookup.TryGetValue(ipsender, out sender);