From f112cebde2c1bc06108839acac82bc8addd7c506 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 22 Jul 2008 17:58:42 +0000 Subject: Refactor the packet scheduling out of ClientView. Add intelligent resending, timeouts, packet discarding. Add notification event for packet discarding. Add priority scheduling for packet queues. Add outgoing duplicate detection facility. Correct packet sequencing. Make provisions for automatic server side throttle adjustments (comes in next installment) --- OpenSim/Framework/BlockingQueue.cs | 20 +++++++++++++++++--- OpenSim/Framework/IClientAPI.cs | 12 ++++++------ OpenSim/Framework/ThrottleOutPacketType.cs | 5 +++-- 3 files changed, 26 insertions(+), 11 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs index 345b361..5b7e911 100644 --- a/OpenSim/Framework/BlockingQueue.cs +++ b/OpenSim/Framework/BlockingQueue.cs @@ -32,9 +32,19 @@ namespace OpenSim.Framework { public class BlockingQueue { + private readonly Queue m_pqueue = new Queue(); private readonly Queue m_queue = new Queue(); private readonly object m_queueSync = new object(); + public void PriorityEnqueue(T value) + { + lock (m_queueSync) + { + m_pqueue.Enqueue(value); + Monitor.Pulse(m_queueSync); + } + } + public void Enqueue(T value) { lock (m_queueSync) @@ -48,11 +58,13 @@ namespace OpenSim.Framework { lock (m_queueSync) { - if (m_queue.Count < 1) + if (m_queue.Count < 1 && m_pqueue.Count < 1) { Monitor.Wait(m_queueSync); } + if(m_pqueue.Count > 0) + return m_pqueue.Dequeue(); return m_queue.Dequeue(); } } @@ -61,6 +73,8 @@ namespace OpenSim.Framework { lock (m_queueSync) { + if(m_pqueue.Contains(item)) + return true; return m_queue.Contains(item); } } @@ -69,7 +83,7 @@ namespace OpenSim.Framework { lock (m_queueSync) { - return m_queue.Count; + return m_queue.Count+m_pqueue.Count; } } @@ -81,4 +95,4 @@ namespace OpenSim.Framework } } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index a835598..b1f62f1 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -254,8 +254,6 @@ namespace OpenSim.Framework public delegate void FriendshipTermination(IClientAPI remoteClient, LLUUID agentID, LLUUID ExID); - public delegate void PacketStats(int inPackets, int outPackets, int unAckedBytes); - public delegate void MoneyTransferRequest(LLUUID sourceID, LLUUID destID, int amount, int transactionType, string description); public delegate void ParcelBuy(LLUUID agentId, LLUUID groupId, bool final, bool groupOwned, @@ -324,6 +322,8 @@ namespace OpenSim.Framework string LastName { get; } + IScene Scene { get; } + // [Obsolete("LLClientView Specific - Replace with ???")] int NextAnimationSequenceNumber { get; } @@ -460,7 +460,6 @@ namespace OpenSim.Framework event FriendActionDelegate OnApproveFriendRequest; event FriendActionDelegate OnDenyFriendRequest; event FriendshipTermination OnTerminateFriendship; - event PacketStats OnPacketStats; // Financial packets event MoneyTransferRequest OnMoneyTransferRequest; @@ -526,7 +525,6 @@ namespace OpenSim.Framework void SendLayerData(float[] map); void SendLayerData(int px, int py, float[] map); - void SendLayerData(int px, int py, float[] map, bool track); void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint); @@ -561,13 +559,14 @@ namespace OpenSim.Framework LLVector3 pos, LLVector3 vel, LLVector3 acc, LLQuaternion rotation, LLVector3 rvel, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, - byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint, LLUUID AssetId, LLUUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius, bool track); + byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint, LLUUID AssetId, LLUUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius); void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLVector3 vel, LLVector3 acc, LLQuaternion rotation, LLVector3 rvel, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, - uint parentID, byte[] particleSystem, byte clickAction, bool track); + uint parentID, byte[] particleSystem, byte clickAction); + void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity, byte state, LLUUID AssetId); @@ -703,6 +702,7 @@ namespace OpenSim.Framework void SetDebug(int newDebug); void InPacket(Packet NewPack); + void ProcessInPacket(Packet NewPack); void Close(bool ShutdownCircuit); void Kick(string message); void Stop(); diff --git a/OpenSim/Framework/ThrottleOutPacketType.cs b/OpenSim/Framework/ThrottleOutPacketType.cs index e045783..27b25d2 100644 --- a/OpenSim/Framework/ThrottleOutPacketType.cs +++ b/OpenSim/Framework/ThrottleOutPacketType.cs @@ -10,6 +10,7 @@ namespace OpenSim.Framework Texture = 5, Asset = 6, Unknown = 7, // Also doubles as 'do not throttle' - Back = 8 + Back = 8, + LowpriorityTask = 9 } -} \ No newline at end of file +} -- cgit v1.1