diff options
author | UbitUmarov | 2014-08-14 20:41:36 +0100 |
---|---|---|
committer | UbitUmarov | 2014-08-14 20:41:36 +0100 |
commit | 8c657e48377213e7ee66c05a4047085cee6084ea (patch) | |
tree | 46103e8a47114a3ee9b0a206f97ee728efeef7eb /OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |
parent | try external bakedModule when local cache is invalid and not just at login (diff) | |
download | opensim-SC_OLD-8c657e48377213e7ee66c05a4047085cee6084ea.zip opensim-SC_OLD-8c657e48377213e7ee66c05a4047085cee6084ea.tar.gz opensim-SC_OLD-8c657e48377213e7ee66c05a4047085cee6084ea.tar.bz2 opensim-SC_OLD-8c657e48377213e7ee66c05a4047085cee6084ea.tar.xz |
add a estimator of client ping time, and painfully make it visible in show
connections console command
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index fe79f87..910d7cf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -293,6 +293,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
293 | /// <summary>Flag to signal when clients should send pings</summary> | 293 | /// <summary>Flag to signal when clients should send pings</summary> |
294 | protected bool m_sendPing; | 294 | protected bool m_sendPing; |
295 | 295 | ||
296 | |||
296 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); | 297 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); |
297 | 298 | ||
298 | /// <summary> | 299 | /// <summary> |
@@ -369,16 +370,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
369 | 370 | ||
370 | // Measure the resolution of Environment.TickCount | 371 | // Measure the resolution of Environment.TickCount |
371 | TickCountResolution = 0f; | 372 | TickCountResolution = 0f; |
372 | for (int i = 0; i < 5; i++) | 373 | for (int i = 0; i < 10; i++) |
373 | { | 374 | { |
374 | int start = Environment.TickCount; | 375 | int start = Environment.TickCount; |
375 | int now = start; | 376 | int now = start; |
376 | while (now == start) | 377 | while (now == start) |
377 | now = Environment.TickCount; | 378 | now = Environment.TickCount; |
378 | TickCountResolution += (float)(now - start) * 0.2f; | 379 | TickCountResolution += (float)(now - start) * 0.1f; |
379 | } | 380 | } |
380 | m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); | ||
381 | TickCountResolution = (float)Math.Ceiling(TickCountResolution); | 381 | TickCountResolution = (float)Math.Ceiling(TickCountResolution); |
382 | m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); | ||
382 | 383 | ||
383 | #endregion Environment.TickCount Measurement | 384 | #endregion Environment.TickCount Measurement |
384 | 385 | ||
@@ -386,6 +387,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
386 | int sceneThrottleBps = 0; | 387 | int sceneThrottleBps = 0; |
387 | bool usePools = false; | 388 | bool usePools = false; |
388 | 389 | ||
390 | |||
391 | |||
389 | IConfig config = configSource.Configs["ClientStack.LindenUDP"]; | 392 | IConfig config = configSource.Configs["ClientStack.LindenUDP"]; |
390 | if (config != null) | 393 | if (config != null) |
391 | { | 394 | { |
@@ -1128,6 +1131,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1128 | pc.PingID.OldestUnacked = 0; | 1131 | pc.PingID.OldestUnacked = 0; |
1129 | 1132 | ||
1130 | SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null); | 1133 | SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null); |
1134 | udpClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); | ||
1131 | } | 1135 | } |
1132 | 1136 | ||
1133 | public void CompletePing(LLUDPClient udpClient, byte pingID) | 1137 | public void CompletePing(LLUDPClient udpClient, byte pingID) |
@@ -1567,7 +1571,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1567 | // We don't need to do anything else with ping checks | 1571 | // We don't need to do anything else with ping checks |
1568 | StartPingCheckPacket startPing = (StartPingCheckPacket)packet; | 1572 | StartPingCheckPacket startPing = (StartPingCheckPacket)packet; |
1569 | CompletePing(udpClient, startPing.PingID.PingID); | 1573 | CompletePing(udpClient, startPing.PingID.PingID); |
1570 | 1574 | ||
1571 | if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) | 1575 | if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) |
1572 | { | 1576 | { |
1573 | udpClient.SendPacketStats(); | 1577 | udpClient.SendPacketStats(); |
@@ -1577,7 +1581,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1577 | } | 1581 | } |
1578 | else if (packet.Type == PacketType.CompletePingCheck) | 1582 | else if (packet.Type == PacketType.CompletePingCheck) |
1579 | { | 1583 | { |
1580 | // We don't currently track client ping times | 1584 | int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS); |
1585 | int c = udpClient.m_pingMS; | ||
1586 | c = 900 * c + 100 * t; | ||
1587 | c /= 1000; | ||
1588 | udpClient.m_pingMS = c; | ||
1581 | return; | 1589 | return; |
1582 | } | 1590 | } |
1583 | 1591 | ||