Remove server pinging.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user