Remove ICMP based pinger

This commit is contained in:
Paul Chote
2013-04-22 20:14:25 +12:00
parent b52a8b27ff
commit 9f4b323287
2 changed files with 5 additions and 63 deletions

View File

@@ -25,8 +25,6 @@ namespace OpenRA.Server
public int ExpectLength = 8;
public int Frame = 0;
public int MostRecentFrame = 0;
public string RemoteAddress;
public int Latency = -1;
/* client data */
public int PlayerIndex;
@@ -101,34 +99,6 @@ namespace OpenRA.Server
}
}
}
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(RemoteAddress, 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;
}
}
}
public enum ReceiveState { Header, Data };