From 08d8a3e5808b790fbbd7ba3f460603db66aeaff2 Mon Sep 17 00:00:00 2001
From: Dan Lake
Date: Mon, 18 Apr 2011 16:48:49 -0700
Subject: Requeue unacknowledged entity updates rather than resend then "as
is". Often, by the time the UDPServer realizes that an entity update packet
has not been acknowledged, there is a newer update for the same entity
already queued up or there is a higher priority update that should be sent
first. This patch eliminates 1:1 packet resends for unacked entity update
packets. Insteawd, unacked update packets are decomposed into the original
entity updates and those updates are placed back into the priority queues
based on their new priority but the original update timestamp. This will
generally place them at the head of the line to be put back on the wire as a
new outgoing packet but prevents the resend queue from filling up with
multiple stale updates for the same entity. This new approach takes advantage
of the UDP nature of the Linden protocol in that the intent of a reliable
update packet is that if it goes unacknowledge, SOMETHING has to happen to
get the update to the client. We are simply making sure that we are resending
current object state rather than stale object state.
Additionally, this patch includes a generalized callback mechanism so
that any caller can specify their own method to call when a packet
expires without being acknowledged. We use this mechanism to requeue
update packets and otherwise use the UDPServer default method of just
putting expired packets in the resend queue.
---
OpenSim/Framework/IClientAPI.cs | 59 ++++++++++++++++++++++++++++++++---------
OpenSim/Framework/Util.cs | 17 ++++++++++++
2 files changed, 64 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index f573c32..069987b 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -572,34 +572,69 @@ namespace OpenSim.Framework
public class IEntityUpdate
{
- public ISceneEntity Entity;
- public uint Flags;
+ private ISceneEntity m_entity;
+ private uint m_flags;
+ private int m_updateTime;
+
+ public ISceneEntity Entity
+ {
+ get { return m_entity; }
+ }
+
+ public uint Flags
+ {
+ get { return m_flags; }
+ }
+
+ public int UpdateTime
+ {
+ get { return m_updateTime; }
+ }
public virtual void Update(IEntityUpdate update)
{
- this.Flags |= update.Flags;
+ m_flags |= update.Flags;
+
+ // Use the older of the updates as the updateTime
+ if (Util.EnvironmentTickCountCompare(UpdateTime, update.UpdateTime) > 0)
+ m_updateTime = update.UpdateTime;
}
public IEntityUpdate(ISceneEntity entity, uint flags)
{
- Entity = entity;
- Flags = flags;
+ m_entity = entity;
+ m_flags = flags;
+ m_updateTime = Util.EnvironmentTickCount();
+ }
+
+ public IEntityUpdate(ISceneEntity entity, uint flags, Int32 updateTime)
+ {
+ m_entity = entity;
+ m_flags = flags;
+ m_updateTime = updateTime;
}
}
-
public class EntityUpdate : IEntityUpdate
{
- // public ISceneEntity Entity;
- // public PrimUpdateFlags Flags;
- public float TimeDilation;
+ private float m_timeDilation;
+
+ public float TimeDilation
+ {
+ get { return m_timeDilation; }
+ }
public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation)
- : base(entity,(uint)flags)
+ : base(entity, (uint)flags)
{
- //Entity = entity;
// Flags = flags;
- TimeDilation = timedilation;
+ m_timeDilation = timedilation;
+ }
+
+ public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation, Int32 updateTime)
+ : base(entity,(uint)flags,updateTime)
+ {
+ m_timeDilation = timedilation;
}
}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 5a5046e..aaa2724 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1537,6 +1537,23 @@ namespace OpenSim.Framework
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
}
+ // Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount
+ // Assumes both tcA and tcB came from previous calls to Util.EnvironmentTickCount().
+ // A positive return value indicates A occured later than B
+ public static Int32 EnvironmentTickCountCompare(Int32 tcA, Int32 tcB)
+ {
+ // A, B and TC are all between 0 and 0x3fffffff
+ int tc = EnvironmentTickCount();
+
+ if (tc - tcA >= 0)
+ tcA += EnvironmentTickCountMask + 1;
+
+ if (tc - tcB >= 0)
+ tcB += EnvironmentTickCountMask + 1;
+
+ return tcA - tcB;
+ }
+
///
/// Prints the call stack at any given point. Useful for debugging.
///
--
cgit v1.1
From 7759bda833c03f4c29500dce32b835a7aef8285b Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Wed, 20 Apr 2011 21:58:49 -0700
Subject: Added an "immediate" queue to the priority queue. This is per
Melanie's very good suggestion. The immediate queue is serviced completely
before all others, making it a very good place to put avatar updates &
attachments.
Moved the priority queue out of the LLUDP directory and
into the framework. It is now a fairly general utility.
---
OpenSim/Framework/PriorityQueue.cs | 258 +++++++++++++++++++++++++++++++++++++
1 file changed, 258 insertions(+)
create mode 100644 OpenSim/Framework/PriorityQueue.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs
new file mode 100644
index 0000000..eec2a92
--- /dev/null
+++ b/OpenSim/Framework/PriorityQueue.cs
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+
+using OpenSim.Framework;
+using OpenSim.Framework.Client;
+using log4net;
+
+namespace OpenSim.Framework
+{
+ public class PriorityQueue
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ public delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity);
+
+ // Heap[0] for self updates
+ // Heap[1..12] for entity updates
+
+ public const uint NumberOfQueues = 12;
+ public const uint ImmediateQueue = 0;
+
+ private MinHeap[] m_heaps = new MinHeap[NumberOfQueues];
+ private Dictionary m_lookupTable;
+ private uint m_nextQueue = 0;
+ private UInt64 m_nextRequest = 0;
+
+ private object m_syncRoot = new object();
+ public object SyncRoot {
+ get { return this.m_syncRoot; }
+ }
+
+ public PriorityQueue() : this(MinHeap.DEFAULT_CAPACITY) { }
+
+ public PriorityQueue(int capacity)
+ {
+ m_lookupTable = new Dictionary(capacity);
+
+ for (int i = 0; i < m_heaps.Length; ++i)
+ m_heaps[i] = new MinHeap(capacity);
+ }
+
+ public int Count
+ {
+ get
+ {
+ int count = 0;
+ for (int i = 0; i < m_heaps.Length; ++i)
+ count += m_heaps[i].Count;
+ return count;
+ }
+ }
+
+ public bool Enqueue(uint pqueue, IEntityUpdate value)
+ {
+ LookupItem lookup;
+
+ uint localid = value.Entity.LocalId;
+ UInt64 entry = m_nextRequest++;
+ if (m_lookupTable.TryGetValue(localid, out lookup))
+ {
+ entry = lookup.Heap[lookup.Handle].EntryOrder;
+ value.Update(lookup.Heap[lookup.Handle].Value);
+ lookup.Heap.Remove(lookup.Handle);
+ }
+
+ pqueue = Util.Clamp(pqueue, 0, NumberOfQueues - 1);
+ lookup.Heap = m_heaps[pqueue];
+ lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle);
+ m_lookupTable[localid] = lookup;
+
+ return true;
+ }
+
+ public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue)
+ {
+ // If there is anything in priority queue 0, return it first no
+ // matter what else. Breaks fairness. But very useful.
+ if (m_heaps[ImmediateQueue].Count > 0)
+ {
+ MinHeapItem item = m_heaps[ImmediateQueue].RemoveMin();
+ m_lookupTable.Remove(item.Value.Entity.LocalId);
+ timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
+ value = item.Value;
+
+ return true;
+ }
+
+ for (int i = 0; i < NumberOfQueues; ++i)
+ {
+ // To get the fair queing, we cycle through each of the
+ // queues when finding an element to dequeue, this code
+ // assumes that the distribution of updates in the queues
+ // is polynomial, probably quadractic (eg distance of PI * R^2)
+ uint h = (uint)((m_nextQueue + i) % NumberOfQueues);
+ if (m_heaps[h].Count > 0)
+ {
+ m_nextQueue = (uint)((h + 1) % NumberOfQueues);
+
+ MinHeapItem item = m_heaps[h].RemoveMin();
+ m_lookupTable.Remove(item.Value.Entity.LocalId);
+ timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
+ value = item.Value;
+
+ return true;
+ }
+ }
+
+ timeinqueue = 0;
+ value = default(IEntityUpdate);
+ return false;
+ }
+
+ public void Reprioritize(UpdatePriorityHandler handler)
+ {
+ MinHeapItem item;
+ foreach (LookupItem lookup in new List(this.m_lookupTable.Values))
+ {
+ if (lookup.Heap.TryGetValue(lookup.Handle, out item))
+ {
+ uint pqueue = item.PriorityQueue;
+ uint localid = item.Value.Entity.LocalId;
+
+ if (handler(ref pqueue, item.Value.Entity))
+ {
+ // unless the priority queue has changed, there is no need to modify
+ // the entry
+ pqueue = Util.Clamp(pqueue, 0, NumberOfQueues - 1);
+ if (pqueue != item.PriorityQueue)
+ {
+ lookup.Heap.Remove(lookup.Handle);
+
+ LookupItem litem = lookup;
+ litem.Heap = m_heaps[pqueue];
+ litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle);
+ m_lookupTable[localid] = litem;
+ }
+ }
+ else
+ {
+ // m_log.WarnFormat("[PQUEUE]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID);
+ lookup.Heap.Remove(lookup.Handle);
+ this.m_lookupTable.Remove(localid);
+ }
+ }
+ }
+ }
+
+ public override string ToString()
+ {
+ string s = "";
+ for (int i = 0; i < NumberOfQueues; i++)
+ {
+ if (s != "") s += ",";
+ s += m_heaps[i].Count.ToString();
+ }
+ return s;
+ }
+
+#region MinHeapItem
+ private struct MinHeapItem : IComparable
+ {
+ private IEntityUpdate value;
+ internal IEntityUpdate Value {
+ get {
+ return this.value;
+ }
+ }
+
+ private uint pqueue;
+ internal uint PriorityQueue {
+ get {
+ return this.pqueue;
+ }
+ }
+
+ private Int32 entrytime;
+ internal Int32 EntryTime {
+ get {
+ return this.entrytime;
+ }
+ }
+
+ private UInt64 entryorder;
+ internal UInt64 EntryOrder
+ {
+ get {
+ return this.entryorder;
+ }
+ }
+
+ internal MinHeapItem(uint pqueue, MinHeapItem other)
+ {
+ this.entrytime = other.entrytime;
+ this.entryorder = other.entryorder;
+ this.value = other.value;
+ this.pqueue = pqueue;
+ }
+
+ internal MinHeapItem(uint pqueue, UInt64 entryorder, IEntityUpdate value)
+ {
+ this.entrytime = Util.EnvironmentTickCount();
+ this.entryorder = entryorder;
+ this.value = value;
+ this.pqueue = pqueue;
+ }
+
+ public override string ToString()
+ {
+ return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId);
+ }
+
+ public int CompareTo(MinHeapItem other)
+ {
+ // I'm assuming that the root part of an SOG is added to the update queue
+ // before the component parts
+ return Comparer.Default.Compare(this.EntryOrder, other.EntryOrder);
+ }
+ }
+#endregion
+
+#region LookupItem
+ private struct LookupItem
+ {
+ internal MinHeap Heap;
+ internal IHandle Handle;
+ }
+#endregion
+ }
+}
--
cgit v1.1
From 3534f4492ae747baff492f4bc10bf06994ee1bc6 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Fri, 22 Apr 2011 14:01:12 -0700
Subject: Various clean ups. Removed some debugging code. Added a new "show
pqueues" command to look at the entity update priority queue. Added a "name"
parameter to show queues, show pqueues and show throttles to look at data for
a specific user.
---
OpenSim/Framework/PriorityQueue.cs | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs
index eec2a92..ea718c4 100644
--- a/OpenSim/Framework/PriorityQueue.cs
+++ b/OpenSim/Framework/PriorityQueue.cs
@@ -174,14 +174,13 @@ namespace OpenSim.Framework
}
}
+ ///
+ ///
public override string ToString()
{
string s = "";
for (int i = 0; i < NumberOfQueues; i++)
- {
- if (s != "") s += ",";
- s += m_heaps[i].Count.ToString();
- }
+ s += String.Format("{0,7} ",m_heaps[i].Count);
return s;
}
--
cgit v1.1
From a3bd769cb33ee59b883998205454bb340d44cb9e Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Fri, 22 Apr 2011 14:55:23 -0700
Subject: Added a second immediate queue to be used for the BestAvatar policy
and currently used for all of an avatars attachments by the other policies.
Also changed the way items are pulled from the update queues to bias close
objects even more.
---
OpenSim/Framework/PriorityQueue.cs | 99 +++++++++++++++++++++++++++++++-------
1 file changed, 82 insertions(+), 17 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs
index ea718c4..8eeafd1 100644
--- a/OpenSim/Framework/PriorityQueue.cs
+++ b/OpenSim/Framework/PriorityQueue.cs
@@ -42,22 +42,40 @@ namespace OpenSim.Framework
public delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity);
- // Heap[0] for self updates
- // Heap[1..12] for entity updates
-
+ ///
+ /// Total number of queues (priorities) available
+ ///
public const uint NumberOfQueues = 12;
- public const uint ImmediateQueue = 0;
+
+ ///
+ /// Number of queuest (priorities) that are processed immediately
+ /// [] m_heaps = new MinHeap[NumberOfQueues];
private Dictionary m_lookupTable;
+
+ // internal state used to ensure the deqeues are spread across the priority
+ // queues "fairly". queuecounts is the amount to pull from each queue in
+ // each pass. weighted towards the higher priority queues
private uint m_nextQueue = 0;
+ private uint m_countFromQueue = 0;
+ private uint[] m_queueCounts = { 8, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1 };
+
+ // next request is a counter of the number of updates queued, it provides
+ // a total ordering on the updates coming through the queue and is more
+ // lightweight (and more discriminating) than tick count
private UInt64 m_nextRequest = 0;
+ ///
+ /// Lock for enqueue and dequeue operations on the priority queue
+ ///
private object m_syncRoot = new object();
public object SyncRoot {
get { return this.m_syncRoot; }
}
+#region constructor
public PriorityQueue() : this(MinHeap.DEFAULT_CAPACITY) { }
public PriorityQueue(int capacity)
@@ -66,8 +84,16 @@ namespace OpenSim.Framework
for (int i = 0; i < m_heaps.Length; ++i)
m_heaps[i] = new MinHeap(capacity);
+
+ m_nextQueue = NumberOfImmediateQueues;
+ m_countFromQueue = m_queueCounts[m_nextQueue];
}
+#endregion Constructor
+#region PublicMethods
+ ///
+ /// Return the number of items in the queues
+ ///
public int Count
{
get
@@ -79,6 +105,9 @@ namespace OpenSim.Framework
}
}
+ ///
+ /// Enqueue an item into the specified priority queue
+ ///
public bool Enqueue(uint pqueue, IEntityUpdate value)
{
LookupItem lookup;
@@ -100,32 +129,62 @@ namespace OpenSim.Framework
return true;
}
+ ///
+ /// Remove an item from one of the queues. Specifically, it removes the
+ /// oldest item from the next queue in order to provide fair access to
+ /// all of the queues
+ ///
public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue)
{
// If there is anything in priority queue 0, return it first no
// matter what else. Breaks fairness. But very useful.
- if (m_heaps[ImmediateQueue].Count > 0)
+ for (int iq = 0; iq < NumberOfImmediateQueues; iq++)
+ {
+ if (m_heaps[iq].Count > 0)
+ {
+ MinHeapItem item = m_heaps[iq].RemoveMin();
+ m_lookupTable.Remove(item.Value.Entity.LocalId);
+ timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
+ value = item.Value;
+
+ return true;
+ }
+ }
+
+ // To get the fair queing, we cycle through each of the
+ // queues when finding an element to dequeue.
+ // We pull (NumberOfQueues - QueueIndex) items from each queue in order
+ // to give lower numbered queues a higher priority and higher percentage
+ // of the bandwidth.
+
+ // Check for more items to be pulled from the current queue
+ if (m_heaps[m_nextQueue].Count > 0 && m_countFromQueue > 0)
{
- MinHeapItem item = m_heaps[ImmediateQueue].RemoveMin();
+ m_countFromQueue--;
+
+ MinHeapItem item = m_heaps[m_nextQueue].RemoveMin();
m_lookupTable.Remove(item.Value.Entity.LocalId);
timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
value = item.Value;
-
+
return true;
}
-
- for (int i = 0; i < NumberOfQueues; ++i)
+
+ // Find the next non-immediate queue with updates in it
+ for (int i = 1; i < NumberOfQueues; ++i)
{
- // To get the fair queing, we cycle through each of the
- // queues when finding an element to dequeue, this code
- // assumes that the distribution of updates in the queues
- // is polynomial, probably quadractic (eg distance of PI * R^2)
- uint h = (uint)((m_nextQueue + i) % NumberOfQueues);
- if (m_heaps[h].Count > 0)
+ m_nextQueue = (uint)((m_nextQueue + i) % NumberOfQueues);
+ m_countFromQueue = m_queueCounts[m_nextQueue];
+
+ // if this is one of the immediate queues, just skip it
+ if (m_nextQueue < NumberOfImmediateQueues)
+ continue;
+
+ if (m_heaps[m_nextQueue].Count > 0)
{
- m_nextQueue = (uint)((h + 1) % NumberOfQueues);
+ m_countFromQueue--;
- MinHeapItem item = m_heaps[h].RemoveMin();
+ MinHeapItem item = m_heaps[m_nextQueue].RemoveMin();
m_lookupTable.Remove(item.Value.Entity.LocalId);
timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
value = item.Value;
@@ -139,6 +198,10 @@ namespace OpenSim.Framework
return false;
}
+ ///
+ /// Reapply the prioritization function to each of the updates currently
+ /// stored in the priority queues.
+ ///
{
--
cgit v1.1
From e2c6ed236d45e91ffb354b1c59e9f5a5a5b7952d Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Sat, 23 Apr 2011 12:17:10 -0700
Subject: Fix a bug looping through the priority queues. This should fix the
problem of not all prims being sent without reprioritization.
---
OpenSim/Framework/PriorityQueue.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs
index 8eeafd1..3e6fdaa 100644
--- a/OpenSim/Framework/PriorityQueue.cs
+++ b/OpenSim/Framework/PriorityQueue.cs
@@ -101,6 +101,7 @@ namespace OpenSim.Framework
int count = 0;
for (int i = 0; i < m_heaps.Length; ++i)
count += m_heaps[i].Count;
+
return count;
}
}
@@ -171,9 +172,9 @@ namespace OpenSim.Framework
}
// Find the next non-immediate queue with updates in it
- for (int i = 1; i < NumberOfQueues; ++i)
+ for (int i = 0; i < NumberOfQueues; ++i)
{
- m_nextQueue = (uint)((m_nextQueue + i) % NumberOfQueues);
+ m_nextQueue = (uint)((m_nextQueue + 1) % NumberOfQueues);
m_countFromQueue = m_queueCounts[m_nextQueue];
// if this is one of the immediate queues, just skip it
--
cgit v1.1
From 549dc5aeb9e693f1f575896796d19b03ec3a732f Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 28 Apr 2011 08:58:04 -0700
Subject: Eliminated sAgentCircuitData, a data structure that has been obsolete
for quite some time.
---
OpenSim/Framework/AgentCircuitData.cs | 69 -----------------------------------
OpenSim/Framework/ClientInfo.cs | 2 +-
2 files changed, 1 insertion(+), 70 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 3dbc215..dbd47d3 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -152,27 +152,6 @@ namespace OpenSim.Framework
}
///
- /// Create AgentCircuitData from a Serializable AgentCircuitData
- ///
- ///
- public AgentCircuitData(sAgentCircuitData cAgent)
- {
- AgentID = new UUID(cAgent.AgentID);
- SessionID = new UUID(cAgent.SessionID);
- SecureSessionID = new UUID(cAgent.SecureSessionID);
- startpos = new Vector3(cAgent.startposx, cAgent.startposy, cAgent.startposz);
- firstname = cAgent.firstname;
- lastname = cAgent.lastname;
- circuitcode = cAgent.circuitcode;
- child = cAgent.child;
- InventoryFolder = new UUID(cAgent.InventoryFolder);
- BaseFolder = new UUID(cAgent.BaseFolder);
- CapsPath = cAgent.CapsPath;
- ChildrenCapSeeds = cAgent.ChildrenCapSeeds;
- Viewer = cAgent.Viewer;
- }
-
- ///
/// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json
///
/// map of the agent circuit data
@@ -369,52 +348,4 @@ namespace OpenSim.Framework
}
- ///
- /// Serializable Agent Circuit Data
- ///
- [Serializable]
- public class sAgentCircuitData
- {
- public Guid AgentID;
- public Guid BaseFolder;
- public string CapsPath = String.Empty;
- public Dictionary ChildrenCapSeeds;
- public bool child;
- public uint circuitcode;
- public string firstname;
- public Guid InventoryFolder;
- public string lastname;
- public Guid SecureSessionID;
- public Guid SessionID;
- public float startposx;
- public float startposy;
- public float startposz;
- public string Viewer;
- public string Channel;
- public string Mac;
- public string Id0;
-
- public sAgentCircuitData()
- {
- }
-
- public sAgentCircuitData(AgentCircuitData cAgent)
- {
- AgentID = cAgent.AgentID.Guid;
- SessionID = cAgent.SessionID.Guid;
- SecureSessionID = cAgent.SecureSessionID.Guid;
- startposx = cAgent.startpos.X;
- startposy = cAgent.startpos.Y;
- startposz = cAgent.startpos.Z;
- firstname = cAgent.firstname;
- lastname = cAgent.lastname;
- circuitcode = cAgent.circuitcode;
- child = cAgent.child;
- InventoryFolder = cAgent.InventoryFolder.Guid;
- BaseFolder = cAgent.BaseFolder.Guid;
- CapsPath = cAgent.CapsPath;
- ChildrenCapSeeds = cAgent.ChildrenCapSeeds;
- Viewer = cAgent.Viewer;
- }
- }
}
diff --git a/OpenSim/Framework/ClientInfo.cs b/OpenSim/Framework/ClientInfo.cs
index fbd18b5..8292c6a 100644
--- a/OpenSim/Framework/ClientInfo.cs
+++ b/OpenSim/Framework/ClientInfo.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Framework
[Serializable]
public class ClientInfo
{
- public sAgentCircuitData agentcircuit;
+ public AgentCircuitData agentcircuit;
public Dictionary needAck;
--
cgit v1.1
From 35f190cc920d3c6fd94c48928d29e15a9b143abf Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 28 Apr 2011 09:06:57 -0700
Subject: One less [Serializable] -- ClientInfo.
---
OpenSim/Framework/ClientInfo.cs | 1 -
1 file changed, 1 deletion(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/ClientInfo.cs b/OpenSim/Framework/ClientInfo.cs
index 8292c6a..62acb70 100644
--- a/OpenSim/Framework/ClientInfo.cs
+++ b/OpenSim/Framework/ClientInfo.cs
@@ -31,7 +31,6 @@ using System.Net;
namespace OpenSim.Framework
{
- [Serializable]
public class ClientInfo
{
public AgentCircuitData agentcircuit;
--
cgit v1.1
From 9892e115ccdcc8567087041917fb5c7694aa8836 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 28 Apr 2011 20:19:54 -0700
Subject: Fatpack message on agent transfers: 1 message only (UpdateAgent)
containing the agent and all attachments. Preserves backwards compatibility
-- older sims get passed attachments one by one. Meaning that I finally
introduced versioning in the simulation service.
---
OpenSim/Framework/ChildAgentDataUpdate.cs | 57 +++++++++++++++++++++---
OpenSim/Framework/Tests/MundaneFrameworkTests.cs | 2 +-
2 files changed, 53 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index ce0b2fb..a626b82 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Framework
UUID AgentID { get; set; }
OSDMap Pack();
- void Unpack(OSDMap map);
+ void Unpack(OSDMap map, IScene scene);
}
///
@@ -122,7 +122,7 @@ namespace OpenSim.Framework
return args;
}
- public void Unpack(OSDMap args)
+ public void Unpack(OSDMap args, IScene scene)
{
if (args.ContainsKey("region_handle"))
UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
@@ -329,6 +329,10 @@ namespace OpenSim.Framework
public string CallbackURI;
+ // These two must have the same Count
+ public List AttachmentObjects;
+ public List AttachmentObjectStates;
+
public virtual OSDMap Pack()
{
m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
@@ -441,7 +445,30 @@ namespace OpenSim.Framework
if ((CallbackURI != null) && (!CallbackURI.Equals("")))
args["callback_uri"] = OSD.FromString(CallbackURI);
+ // Attachment objects for fatpack messages
+ if (AttachmentObjects != null)
+ {
+ int i = 0;
+ OSDArray attObjs = new OSDArray(AttachmentObjects.Count);
+ foreach (ISceneObject so in AttachmentObjects)
+ {
+ OSDMap info = new OSDMap(4);
+ info["sog"] = OSD.FromString(so.ToXml2());
+ info["extra"] = OSD.FromString(so.ExtraToXmlString());
+ info["modified"] = OSD.FromBoolean(so.HasGroupChanged);
+ try
+ {
+ info["state"] = OSD.FromString(AttachmentObjectStates[i++]);
+ }
+ catch (IndexOutOfRangeException e)
+ {
+ m_log.WarnFormat("[CHILD AGENT DATA]: scrtips list is shorter than object list.");
+ }
+ attObjs.Add(info);
+ }
+ args["attach_objects"] = attObjs;
+ }
return args;
}
@@ -450,7 +477,7 @@ namespace OpenSim.Framework
/// Avoiding reflection makes it painful to write, but that's the price!
///
///
- public virtual void Unpack(OSDMap args)
+ public virtual void Unpack(OSDMap args, IScene scene)
{
m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
@@ -628,6 +655,26 @@ namespace OpenSim.Framework
if (args["callback_uri"] != null)
CallbackURI = args["callback_uri"].AsString();
+
+ // Attachment objects
+ if (args["attach_objects"] != null && args["attach_objects"].Type == OSDType.Array)
+ {
+ OSDArray attObjs = (OSDArray)(args["attach_objects"]);
+ AttachmentObjects = new List();
+ AttachmentObjectStates = new List();
+ foreach (OSD o in attObjs)
+ {
+ if (o.Type == OSDType.Map)
+ {
+ OSDMap info = (OSDMap)o;
+ ISceneObject so = scene.DeserializeObject(info["sog"].AsString());
+ so.ExtraFromXmlString(info["extra"].AsString());
+ so.HasGroupChanged = info["modified"].AsBoolean();
+ AttachmentObjects.Add(so);
+ AttachmentObjectStates.Add(info["state"].AsString());
+ }
+ }
+ }
}
public AgentData()
@@ -655,9 +702,9 @@ namespace OpenSim.Framework
return base.Pack();
}
- public override void Unpack(OSDMap map)
+ public override void Unpack(OSDMap map, IScene scene)
{
- base.Unpack(map);
+ base.Unpack(map, scene);
}
}
}
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index e7f8bfc..76de6be 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -115,7 +115,7 @@ namespace OpenSim.Framework.Tests
position2 = new AgentPosition();
Assert.IsFalse(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition");
- position2.Unpack(position1.Pack());
+ position2.Unpack(position1.Pack(), null);
Assert.IsTrue(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed");
Assert.IsTrue(position2.Position == position1.Position, "Position didn't unpack the same way it packed");
--
cgit v1.1
From 56df7461330b1d193f3f60274525eb1b128315ef Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 30 Apr 2011 16:53:43 -0700
Subject: XXX DEBUGGING!
---
OpenSim/Framework/ChildAgentDataUpdate.cs | 3 ++-
OpenSim/Framework/WebUtil.cs | 11 ++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index a626b82..c4b5dde 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -454,6 +454,7 @@ namespace OpenSim.Framework
{
OSDMap info = new OSDMap(4);
info["sog"] = OSD.FromString(so.ToXml2());
+ m_log.DebugFormat("[XXX] {0}", so.ToXml2());
info["extra"] = OSD.FromString(so.ExtraToXmlString());
info["modified"] = OSD.FromBoolean(so.HasGroupChanged);
try
@@ -462,7 +463,7 @@ namespace OpenSim.Framework
}
catch (IndexOutOfRangeException e)
{
- m_log.WarnFormat("[CHILD AGENT DATA]: scrtips list is shorter than object list.");
+ m_log.WarnFormat("[CHILD AGENT DATA]: scripts list is shorter than object list.");
}
attObjs.Add(info);
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 9d70f63..5449a6f 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -177,7 +177,16 @@ namespace OpenSim.Framework
// If there is some input, write it into the request
if (data != null)
{
- string strBuffer = OSDParser.SerializeJsonString(data);
+ string strBuffer = string.Empty;
+ try
+ {
+ strBuffer = OSDParser.SerializeJsonString(data);
+ }
+ catch (Exception e)
+ {
+ m_log.DebugFormat("[WEB UTIL]: Exception serializing data {0}", e.Message);
+ throw e;
+ }
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
request.ContentType = "application/json";
--
cgit v1.1
From 91a604d4b6822130871f35ddbc2c53f3468c2a01 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 30 Apr 2011 17:40:21 -0700
Subject: Removed XXX Debug. Increased ReadWriteTimeout on ServiceOSDRequest,
because it was _way_ too low and is probably making writes abort in the
middle.
---
OpenSim/Framework/ChildAgentDataUpdate.cs | 1 -
OpenSim/Framework/WebUtil.cs | 15 +++------------
2 files changed, 3 insertions(+), 13 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index c4b5dde..28fe3ba 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -454,7 +454,6 @@ namespace OpenSim.Framework
{
OSDMap info = new OSDMap(4);
info["sog"] = OSD.FromString(so.ToXml2());
- m_log.DebugFormat("[XXX] {0}", so.ToXml2());
info["extra"] = OSD.FromString(so.ExtraToXmlString());
info["modified"] = OSD.FromBoolean(so.HasGroupChanged);
try
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 5449a6f..f6fed33 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -171,24 +171,15 @@ namespace OpenSim.Framework
request.Timeout = timeout;
request.KeepAlive = false;
request.MaximumAutomaticRedirections = 10;
- request.ReadWriteTimeout = timeout / 4;
+ request.ReadWriteTimeout = timeout * 8;
request.Headers[OSHeaderRequestID] = reqnum.ToString();
// If there is some input, write it into the request
if (data != null)
{
- string strBuffer = string.Empty;
- try
- {
- strBuffer = OSDParser.SerializeJsonString(data);
- }
- catch (Exception e)
- {
- m_log.DebugFormat("[WEB UTIL]: Exception serializing data {0}", e.Message);
- throw e;
- }
+ string strBuffer = OSDParser.SerializeJsonString(data);
byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer);
-
+
request.ContentType = "application/json";
request.ContentLength = buffer.Length; //Count bytes to send
using (Stream requestStream = request.GetRequestStream())
--
cgit v1.1
From d4323dd7530734ed2c35138722ed8c9c01d53d4e Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 30 Apr 2011 18:08:48 -0700
Subject: Increased Timeout to 30 secs.
---
OpenSim/Framework/WebUtil.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index f6fed33..ac0828b 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -142,17 +142,17 @@ namespace OpenSim.Framework
///
public static OSDMap PutToService(string url, OSDMap data)
{
- return ServiceOSDRequest(url,data,"PUT",10000);
+ return ServiceOSDRequest(url,data,"PUT",30000);
}
public static OSDMap PostToService(string url, OSDMap data)
{
- return ServiceOSDRequest(url,data,"POST",10000);
+ return ServiceOSDRequest(url,data,"POST",30000);
}
public static OSDMap GetFromService(string url)
{
- return ServiceOSDRequest(url,null,"GET",10000);
+ return ServiceOSDRequest(url,null,"GET",30000);
}
public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout)
--
cgit v1.1