Overhaul client latency calculations.
The ping/pong orders are replaced with a dedicated (and much smaller) Ping packet that is handled directly in the client and server Connection wrappers. This allows clients to respond when the orders are processed, instead of queuing the pong order to be sent in the next frame (which added an extra 120ms of unwanted latency). The ping frequency has been raised to 1Hz, and pings are now routed through the server events queue in preparation for the future dynamic latency system. The raw ping numbers are no longer sent to clients, the server instead evaluates a single ConnectionQuality value that in the future may be based on more than just the ping times.
This commit is contained in:
@@ -304,6 +304,14 @@ namespace OpenRA.Network
|
||||
orderManager.ReceiveDisconnect(disconnect.ClientId, disconnect.Frame);
|
||||
else if (OrderIO.TryParseSync(p.Data, out var sync))
|
||||
orderManager.ReceiveSync(sync);
|
||||
else if (OrderIO.TryParsePing(p.FromClient, p.Data, out var ping))
|
||||
{
|
||||
// The Ping packet is sent back directly without changes
|
||||
// Note that processing this here, rather than in NetworkConnectionReceive,
|
||||
// so that poor world tick performance can be reflected in the latency measurement
|
||||
Send(ping);
|
||||
record = false;
|
||||
}
|
||||
else if (OrderIO.TryParseAck(p, out var ackFrame))
|
||||
{
|
||||
if (!sentOrders.TryDequeue(out var q))
|
||||
|
||||
Reference in New Issue
Block a user