Fix showing wrong IP for server admins in the lobby client tooltips

The external IP will now only be resolved for the local client.
This commit is contained in:
Oliver Brakmann
2015-01-16 20:15:43 +01:00
parent c092c0231f
commit 2267530865

View File

@@ -76,7 +76,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
latency.GetText = () => LobbyUtils.LatencyDescription(ping); latency.GetText = () => LobbyUtils.LatencyDescription(ping);
latency.GetColor = () => LobbyUtils.LatencyColor(ping); latency.GetColor = () => LobbyUtils.LatencyColor(ping);
var address = orderManager.LobbyInfo.ClientWithIndex(clientIndex).IpAddress; var address = orderManager.LobbyInfo.ClientWithIndex(clientIndex).IpAddress;
if (address == IPAddress.Loopback.ToString() && UPnP.NatDevice != null) if (clientIndex == orderManager.LocalClient.Index && UPnP.NatDevice != null
&& address == IPAddress.Loopback.ToString())
address = UPnP.NatDevice.GetExternalIP().ToString(); address = UPnP.NatDevice.GetExternalIP().ToString();
var cachedDescriptiveIP = LobbyUtils.DescriptiveIpAddress(address); var cachedDescriptiveIP = LobbyUtils.DescriptiveIpAddress(address);
ip.GetText = () => cachedDescriptiveIP; ip.GetText = () => cachedDescriptiveIP;