diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index fe79f87..3b0312d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -293,6 +293,21 @@ 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 | private int m_animationSequenceNumber; | ||
297 | |||
298 | public int NextAnimationSequenceNumber | ||
299 | { | ||
300 | get | ||
301 | { | ||
302 | m_animationSequenceNumber++; | ||
303 | if (m_animationSequenceNumber > 2147482624) | ||
304 | m_animationSequenceNumber = 1; | ||
305 | return m_animationSequenceNumber; | ||
306 | } | ||
307 | } | ||
308 | |||
309 | |||
310 | |||
296 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); | 311 | private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); |
297 | 312 | ||
298 | /// <summary> | 313 | /// <summary> |
@@ -369,16 +384,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
369 | 384 | ||
370 | // Measure the resolution of Environment.TickCount | 385 | // Measure the resolution of Environment.TickCount |
371 | TickCountResolution = 0f; | 386 | TickCountResolution = 0f; |
372 | for (int i = 0; i < 5; i++) | 387 | for (int i = 0; i < 10; i++) |
373 | { | 388 | { |
374 | int start = Environment.TickCount; | 389 | int start = Environment.TickCount; |
375 | int now = start; | 390 | int now = start; |
376 | while (now == start) | 391 | while (now == start) |
377 | now = Environment.TickCount; | 392 | now = Environment.TickCount; |
378 | TickCountResolution += (float)(now - start) * 0.2f; | 393 | TickCountResolution += (float)(now - start) * 0.1f; |
379 | } | 394 | } |
380 | m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); | ||
381 | TickCountResolution = (float)Math.Ceiling(TickCountResolution); | 395 | TickCountResolution = (float)Math.Ceiling(TickCountResolution); |
396 | m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); | ||
382 | 397 | ||
383 | #endregion Environment.TickCount Measurement | 398 | #endregion Environment.TickCount Measurement |
384 | 399 | ||
@@ -386,6 +401,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
386 | int sceneThrottleBps = 0; | 401 | int sceneThrottleBps = 0; |
387 | bool usePools = false; | 402 | bool usePools = false; |
388 | 403 | ||
404 | |||
405 | |||
389 | IConfig config = configSource.Configs["ClientStack.LindenUDP"]; | 406 | IConfig config = configSource.Configs["ClientStack.LindenUDP"]; |
390 | if (config != null) | 407 | if (config != null) |
391 | { | 408 | { |
@@ -435,6 +452,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
435 | m_throttle = new TokenBucket(null, sceneThrottleBps); | 452 | m_throttle = new TokenBucket(null, sceneThrottleBps); |
436 | ThrottleRates = new ThrottleRates(configSource); | 453 | ThrottleRates = new ThrottleRates(configSource); |
437 | 454 | ||
455 | Random rnd = new Random(Util.EnvironmentTickCount()); | ||
456 | m_animationSequenceNumber = rnd.Next(11474826); | ||
457 | |||
438 | if (usePools) | 458 | if (usePools) |
439 | EnablePools(); | 459 | EnablePools(); |
440 | } | 460 | } |
@@ -1128,6 +1148,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1128 | pc.PingID.OldestUnacked = 0; | 1148 | pc.PingID.OldestUnacked = 0; |
1129 | 1149 | ||
1130 | SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null); | 1150 | SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null); |
1151 | udpClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); | ||
1131 | } | 1152 | } |
1132 | 1153 | ||
1133 | public void CompletePing(LLUDPClient udpClient, byte pingID) | 1154 | public void CompletePing(LLUDPClient udpClient, byte pingID) |
@@ -1567,7 +1588,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1567 | // We don't need to do anything else with ping checks | 1588 | // We don't need to do anything else with ping checks |
1568 | StartPingCheckPacket startPing = (StartPingCheckPacket)packet; | 1589 | StartPingCheckPacket startPing = (StartPingCheckPacket)packet; |
1569 | CompletePing(udpClient, startPing.PingID.PingID); | 1590 | CompletePing(udpClient, startPing.PingID.PingID); |
1570 | 1591 | ||
1571 | if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) | 1592 | if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) |
1572 | { | 1593 | { |
1573 | udpClient.SendPacketStats(); | 1594 | udpClient.SendPacketStats(); |
@@ -1577,7 +1598,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1577 | } | 1598 | } |
1578 | else if (packet.Type == PacketType.CompletePingCheck) | 1599 | else if (packet.Type == PacketType.CompletePingCheck) |
1579 | { | 1600 | { |
1580 | // We don't currently track client ping times | 1601 | int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS); |
1602 | int c = udpClient.m_pingMS; | ||
1603 | c = 800 * c + 200 * t; | ||
1604 | c /= 1000; | ||
1605 | udpClient.m_pingMS = c; | ||
1581 | return; | 1606 | return; |
1582 | } | 1607 | } |
1583 | 1608 | ||