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