1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-17 23:56:30 +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,7 +24,7 @@ namespace Lidgren.Network
private object m_initializeLock = new object(); private object m_initializeLock = new object();
private uint m_frameCounter; private uint m_frameCounter;
private double m_lastHeartbeat; private double m_lastHeartbeat;
private NetPortForwarding m_portForwarding; private NetUPnP m_upnp;
internal readonly NetPeerConfiguration m_configuration; internal readonly NetPeerConfiguration m_configuration;
private readonly NetQueue<NetIncomingMessage> m_releasedIncomingMessages; private readonly NetQueue<NetIncomingMessage> m_releasedIncomingMessages;
@@ -99,8 +99,8 @@ namespace Lidgren.Network
if (m_status == NetPeerStatus.Running) if (m_status == NetPeerStatus.Running)
return; return;
if (m_configuration.m_enablePortForwarding) if (m_configuration.m_enableUPnP)
m_portForwarding = new NetPortForwarding(this); m_upnp = new NetUPnP(this);
InitializePools(); InitializePools();
@@ -403,8 +403,22 @@ namespace Lidgren.Network
IPEndPoint ipsender = (IPEndPoint)m_senderRemote; IPEndPoint ipsender = (IPEndPoint)m_senderRemote;
if (m_portForwarding != null && m_portForwarding.IsDiscovering) if (m_upnp != null && now < m_upnp.m_discoveryResponseDeadline)
m_portForwarding.HandlePotentialDiscovery(ipsender, m_receiveBuffer, bytesReceived); {
// 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; NetConnection sender = null;
m_connectionLookup.TryGetValue(ipsender, out sender); m_connectionLookup.TryGetValue(ipsender, out sender);