diff --git a/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs b/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs index 3d29753e77..ae9ee81bbf 100644 --- a/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs +++ b/OpenRA.Mods.Common/ServerTraits/PlayerPinger.cs @@ -35,11 +35,10 @@ namespace OpenRA.Mods.Common.Server isInitialPing = false; lastPing = Game.RunTime; - if (server.LobbyInfo.IsSinglePlayer && server.Conns.Any() && server.GetClient(server.Conns.First()).IpAddress == "127.0.0.1") - { + // Ignore client timeout in singleplayer games to make debugging easier + if (server.LobbyInfo.IsSinglePlayer && !server.Settings.Dedicated) foreach (var c in server.Conns.ToList()) server.SendOrderTo(c, "Ping", Game.RunTime.ToString()); - } else { foreach (var c in server.Conns.ToList()) diff --git a/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs index 2ac1c59b26..caaa25ae53 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ClientTooltipLogic.cs @@ -9,6 +9,7 @@ #endregion using System; +using System.Net; using OpenRA.Network; using OpenRA.Widgets; @@ -76,7 +77,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic latency.GetText = () => LobbyUtils.LatencyDescription(ping); latency.GetColor = () => LobbyUtils.LatencyColor(ping); var address = orderManager.LobbyInfo.ClientWithIndex(clientIndex).IpAddress; - if (address == "127.0.0.1" && UPnP.NatDevice != null) + if (address == IPAddress.Loopback.ToString() && UPnP.NatDevice != null) address = UPnP.NatDevice.GetExternalIP().ToString(); var cachedDescriptiveIP = LobbyUtils.DescriptiveIpAddress(address); ip.GetText = () => cachedDescriptiveIP; diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs index 41723428af..c022822c1b 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.Linq; +using System.Net; using OpenRA.Graphics; using OpenRA.Mods.Common.Widgets; using OpenRA.Network; @@ -224,7 +225,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic { if (ip == null) return "Unknown Host"; - if (ip == "127.0.0.1") + if (ip == IPAddress.Loopback.ToString()) return "Local Host"; return ip; }