aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs11
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs9
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs2
4 files changed, 8 insertions, 18 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
index 71f4c47..2d86a40 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs
@@ -531,11 +531,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
531 /// as an object to match the WaitCallback delegate signature</param> 531 /// as an object to match the WaitCallback delegate signature</param>
532 private void FireQueueEmpty(object o) 532 private void FireQueueEmpty(object o)
533 { 533 {
534 const int MIN_CALLBACK_MS = 30;
535
534 int i = (int)o; 536 int i = (int)o;
535 ThrottleOutPacketType type = (ThrottleOutPacketType)i; 537 ThrottleOutPacketType type = (ThrottleOutPacketType)i;
536 QueueEmpty callback = OnQueueEmpty; 538 QueueEmpty callback = OnQueueEmpty;
537 539
538 int start = Environment.TickCount; 540 int start = Environment.TickCount & Int32.MaxValue;
539 541
540 if (callback != null) 542 if (callback != null)
541 { 543 {
@@ -543,10 +545,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
543 catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + type + ") threw an exception: " + e.Message, e); } 545 catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + type + ") threw an exception: " + e.Message, e); }
544 } 546 }
545 547
546 // Make sure all queue empty calls take at least a measurable amount of time, 548 // Make sure all queue empty calls take at least some amount of time,
547 // otherwise we'll peg a CPU trying to fire these too fast 549 // otherwise we'll peg a CPU trying to fire these too fast
548 if (Environment.TickCount == start) 550 int elapsedMS = (Environment.TickCount & Int32.MaxValue) - start;
549 System.Threading.Thread.Sleep((int)m_udpServer.TickCountResolution); 551 if (elapsedMS < MIN_CALLBACK_MS)
552 System.Threading.Thread.Sleep(MIN_CALLBACK_MS - elapsedMS);
550 553
551 m_onQueueEmptyRunning[i] = false; 554 m_onQueueEmptyRunning[i] = false;
552 } 555 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 4bdf132..40d3771 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -674,10 +674,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
674 packetInbox.Enqueue(new IncomingPacket(udpClient, packet)); 674 packetInbox.Enqueue(new IncomingPacket(udpClient, packet));
675 } 675 }
676 676
677 protected override void PacketSent(UDPPacketBuffer buffer, int bytesSent)
678 {
679 }
680
681 private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber) 677 private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
682 { 678 {
683 PacketAckPacket ack = new PacketAckPacket(); 679 PacketAckPacket ack = new PacketAckPacket();
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs
index d16837d..552cc4a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs
@@ -45,13 +45,6 @@ namespace OpenMetaverse
45 /// </summary> 45 /// </summary>
46 /// <param name="buffer">Incoming packet buffer</param> 46 /// <param name="buffer">Incoming packet buffer</param>
47 protected abstract void PacketReceived(UDPPacketBuffer buffer); 47 protected abstract void PacketReceived(UDPPacketBuffer buffer);
48
49 /// <summary>
50 /// This method is called when an outgoing packet is sent
51 /// </summary>
52 /// <param name="buffer">Outgoing packet buffer</param>
53 /// <param name="bytesSent">Number of bytes written to the wire</param>
54 protected abstract void PacketSent(UDPPacketBuffer buffer, int bytesSent);
55 48
56 /// <summary>UDP port to bind to in server mode</summary> 49 /// <summary>UDP port to bind to in server mode</summary>
57 protected int m_udpPort; 50 protected int m_udpPort;
@@ -279,8 +272,6 @@ namespace OpenMetaverse
279 { 272 {
280 UDPPacketBuffer buf = (UDPPacketBuffer)result.AsyncState; 273 UDPPacketBuffer buf = (UDPPacketBuffer)result.AsyncState;
281 int bytesSent = m_udpSocket.EndSendTo(result); 274 int bytesSent = m_udpSocket.EndSendTo(result);
282
283 PacketSent(buf, bytesSent);
284 } 275 }
285 catch (SocketException) { } 276 catch (SocketException) { }
286 catch (ObjectDisposedException) { } 277 catch (ObjectDisposedException) { }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index 016712f..3e2e81c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
60 } 60 }
61 61
62 /// <summary>Holds the actual unacked packet data, sorted by sequence number</summary> 62 /// <summary>Holds the actual unacked packet data, sorted by sequence number</summary>
63 private SortedDictionary<uint, OutgoingPacket> m_packets = new SortedDictionary<uint, OutgoingPacket>(); 63 private Dictionary<uint, OutgoingPacket> m_packets = new Dictionary<uint, OutgoingPacket>();
64 /// <summary>Holds packets that need to be added to the unacknowledged list</summary> 64 /// <summary>Holds packets that need to be added to the unacknowledged list</summary>
65 private LocklessQueue<OutgoingPacket> m_pendingAdds = new LocklessQueue<OutgoingPacket>(); 65 private LocklessQueue<OutgoingPacket> m_pendingAdds = new LocklessQueue<OutgoingPacket>();
66 /// <summary>Holds information about pending acknowledgements</summary> 66 /// <summary>Holds information about pending acknowledgements</summary>