Remove server pinging.

This commit is contained in:
Paul Chote
2013-05-04 22:03:15 +12:00
parent d7eac12d64
commit c0d50c2ac1
3 changed files with 1 additions and 87 deletions

View File

@@ -67,33 +67,5 @@ namespace OpenRA.Network
return UsefulMods.All(m => Game.CurrentMods.ContainsKey(m.Key)
&& AreVersionsCompatible(m.Value, Game.CurrentMods[m.Key].Version));
}
public int Latency = -1;
bool hasBeenPinged;
public void Ping()
{
if (!hasBeenPinged)
{
hasBeenPinged = true;
var pingSender = new Ping();
pingSender.PingCompleted += new PingCompletedEventHandler(pongRecieved);
AutoResetEvent waiter = new AutoResetEvent(false);
pingSender.SendAsync(Address.Split(':')[0], waiter);
}
}
void pongRecieved(object sender, PingCompletedEventArgs e)
{
if (e.Cancelled || e.Error != null)
Latency = -1;
else
{
PingReply pong = e.Reply;
if (pong != null && pong.Status == IPStatus.Success)
Latency = (int)pong.RoundtripTime;
else
Latency = -1;
}
}
}
}