aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs2
-rw-r--r--OpenSim/Framework/Util.cs108
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs77
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs108
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--prebuild.xml3
7 files changed, 190 insertions, 117 deletions
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
index 9a6ca86..11a2698 100644
--- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
+++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs
@@ -435,4 +435,4 @@ namespace OpenSim.Capabilities.Handlers
435 return llsdItem; 435 return llsdItem;
436 } 436 }
437 } 437 }
438} \ No newline at end of file 438}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index e76a37b..48f3f8b 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2097,4 +2097,112 @@ namespace OpenSim.Framework
2097 } 2097 }
2098 #endregion 2098 #endregion
2099 } 2099 }
2100
2101 public class DoubleQueue<T> where T:class
2102 {
2103 private Queue<T> m_lowQueue = new Queue<T>();
2104 private Queue<T> m_highQueue = new Queue<T>();
2105
2106 private object m_syncRoot = new object();
2107 private Semaphore m_s = new Semaphore(0, 1);
2108
2109 public DoubleQueue()
2110 {
2111 }
2112
2113 public virtual int Count
2114 {
2115 get { return m_highQueue.Count + m_lowQueue.Count; }
2116 }
2117
2118 public virtual void Enqueue(T data)
2119 {
2120 Enqueue(m_lowQueue, data);
2121 }
2122
2123 public virtual void EnqueueLow(T data)
2124 {
2125 Enqueue(m_lowQueue, data);
2126 }
2127
2128 public virtual void EnqueueHigh(T data)
2129 {
2130 Enqueue(m_highQueue, data);
2131 }
2132
2133 private void Enqueue(Queue<T> q, T data)
2134 {
2135 lock (m_syncRoot)
2136 {
2137 m_lowQueue.Enqueue(data);
2138 m_s.WaitOne(0);
2139 m_s.Release();
2140 }
2141 }
2142
2143 public virtual T Dequeue()
2144 {
2145 return Dequeue(Timeout.Infinite);
2146 }
2147
2148 public virtual T Dequeue(int tmo)
2149 {
2150 return Dequeue(TimeSpan.FromMilliseconds(tmo));
2151 }
2152
2153 public virtual T Dequeue(TimeSpan wait)
2154 {
2155 T res = null;
2156
2157 if (!Dequeue(wait, ref res))
2158 return null;
2159
2160 return res;
2161 }
2162
2163 public bool Dequeue(int timeout, ref T res)
2164 {
2165 return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res);
2166 }
2167
2168 public bool Dequeue(TimeSpan wait, ref T res)
2169 {
2170 if (!m_s.WaitOne(wait))
2171 return false;
2172
2173 lock (m_syncRoot)
2174 {
2175 if (m_highQueue.Count > 0)
2176 res = m_highQueue.Dequeue();
2177 else
2178 res = m_lowQueue.Dequeue();
2179
2180 if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
2181 return true;
2182
2183 try
2184 {
2185 m_s.Release();
2186 }
2187 catch
2188 {
2189 }
2190
2191 return true;
2192 }
2193 }
2194
2195 public virtual void Clear()
2196 {
2197
2198 lock (m_syncRoot)
2199 {
2200 // Make sure sem count is 0
2201 m_s.WaitOne(0);
2202
2203 m_lowQueue.Clear();
2204 m_highQueue.Clear();
2205 }
2206 }
2207 }
2100} 2208}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 04cd474..a823dd8 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -39,10 +39,13 @@ using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer; 39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Framework.Capabilities;
42using OpenSim.Services.Interfaces; 43using OpenSim.Services.Interfaces;
43using Caps = OpenSim.Framework.Capabilities.Caps; 44using Caps = OpenSim.Framework.Capabilities.Caps;
44using OpenSim.Capabilities.Handlers; 45using OpenSim.Capabilities.Handlers;
45using OpenSim.Framework.Monitoring; 46using OpenSim.Framework.Monitoring;
47using OpenMetaverse;
48using OpenMetaverse.StructuredData;
46 49
47namespace OpenSim.Region.ClientStack.Linden 50namespace OpenSim.Region.ClientStack.Linden
48{ 51{
@@ -52,11 +55,13 @@ namespace OpenSim.Region.ClientStack.Linden
52 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")]
53 public class WebFetchInvDescModule : INonSharedRegionModule 56 public class WebFetchInvDescModule : INonSharedRegionModule
54 { 57 {
55 struct aPollRequest 58 class aPollRequest
56 { 59 {
57 public PollServiceInventoryEventArgs thepoll; 60 public PollServiceInventoryEventArgs thepoll;
58 public UUID reqID; 61 public UUID reqID;
59 public Hashtable request; 62 public Hashtable request;
63 public ScenePresence presence;
64 public List<UUID> folders;
60 } 65 }
61 66
62 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -71,8 +76,8 @@ namespace OpenSim.Region.ClientStack.Linden
71 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); 76 private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
72 private static Thread[] m_workerThreads = null; 77 private static Thread[] m_workerThreads = null;
73 78
74 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = 79 private static DoubleQueue<aPollRequest> m_queue =
75 new OpenMetaverse.BlockingQueue<aPollRequest>(); 80 new DoubleQueue<aPollRequest>();
76 81
77 #region ISharedRegionModule Members 82 #region ISharedRegionModule Members
78 83
@@ -143,12 +148,18 @@ namespace OpenSim.Region.ClientStack.Linden
143 148
144 private class PollServiceInventoryEventArgs : PollServiceEventArgs 149 private class PollServiceInventoryEventArgs : PollServiceEventArgs
145 { 150 {
151 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
152
146 private Dictionary<UUID, Hashtable> responses = 153 private Dictionary<UUID, Hashtable> responses =
147 new Dictionary<UUID, Hashtable>(); 154 new Dictionary<UUID, Hashtable>();
148 155
149 public PollServiceInventoryEventArgs(UUID pId) : 156 private Scene m_scene;
157
158 public PollServiceInventoryEventArgs(Scene scene, UUID pId) :
150 base(null, null, null, null, pId, int.MaxValue) 159 base(null, null, null, null, pId, int.MaxValue)
151 { 160 {
161 m_scene = scene;
162
152 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; 163 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
153 GetEvents = (x, y) => 164 GetEvents = (x, y) =>
154 { 165 {
@@ -167,12 +178,64 @@ namespace OpenSim.Region.ClientStack.Linden
167 178
168 Request = (x, y) => 179 Request = (x, y) =>
169 { 180 {
181 ScenePresence sp = m_scene.GetScenePresence(Id);
182 if (sp == null)
183 {
184 m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id);
185 return;
186 }
187
170 aPollRequest reqinfo = new aPollRequest(); 188 aPollRequest reqinfo = new aPollRequest();
171 reqinfo.thepoll = this; 189 reqinfo.thepoll = this;
172 reqinfo.reqID = x; 190 reqinfo.reqID = x;
173 reqinfo.request = y; 191 reqinfo.request = y;
192 reqinfo.presence = sp;
193 reqinfo.folders = new List<UUID>();
194
195 // Decode the request here
196 string request = y["body"].ToString();
197
198 request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
199
200 request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
201 request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
202
203 Hashtable hash = new Hashtable();
204 try
205 {
206 hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request));
207 }
208 catch (LLSD.LLSDParseException e)
209 {
210 m_log.ErrorFormat("[INVENTORY]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
211 m_log.Error("Request: " + request);
212 return;
213 }
214
215 ArrayList foldersrequested = (ArrayList)hash["folders"];
216
217 bool highPriority = false;
218
219 for (int i = 0; i < foldersrequested.Count; i++)
220 {
221 Hashtable inventoryhash = (Hashtable)foldersrequested[i];
222 string folder = inventoryhash["folder_id"].ToString();
223 UUID folderID;
224 if (UUID.TryParse(folder, out folderID))
225 {
226 if (!reqinfo.folders.Contains(folderID))
227 {
228 if (sp.COF != UUID.Zero && sp.COF == folderID)
229 highPriority = true;
230 reqinfo.folders.Add(folderID);
231 }
232 }
233 }
174 234
175 m_queue.Enqueue(reqinfo); 235 if (highPriority)
236 m_queue.EnqueueHigh(reqinfo);
237 else
238 m_queue.EnqueueLow(reqinfo);
176 }; 239 };
177 240
178 NoEvents = (x, y) => 241 NoEvents = (x, y) =>
@@ -208,7 +271,7 @@ namespace OpenSim.Region.ClientStack.Linden
208 response["reusecontext"] = false; 271 response["reusecontext"] = false;
209 272
210 response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest( 273 response["str_response_string"] = m_webFetchHandler.FetchInventoryDescendentsRequest(
211 requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); 274 requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null);
212 275
213 lock (responses) 276 lock (responses)
214 responses[requestID] = response; 277 responses[requestID] = response;
@@ -220,7 +283,7 @@ namespace OpenSim.Region.ClientStack.Linden
220 string capUrl = "/CAPS/" + UUID.Random() + "/"; 283 string capUrl = "/CAPS/" + UUID.Random() + "/";
221 284
222 // Register this as a poll service 285 // Register this as a poll service
223 PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(agentID); 286 PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, agentID);
224 287
225 args.Type = PollServiceEventArgs.EventType.Inventory; 288 args.Type = PollServiceEventArgs.EventType.Inventory;
226 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); 289 MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 6c72edc..d49f1f7 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1903,112 +1903,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1903 } 1903 }
1904 } 1904 }
1905 } 1905 }
1906
1907 internal class DoubleQueue<T> where T:class
1908 {
1909 private Queue<T> m_lowQueue = new Queue<T>();
1910 private Queue<T> m_highQueue = new Queue<T>();
1911
1912 private object m_syncRoot = new object();
1913 private Semaphore m_s = new Semaphore(0, 1);
1914
1915 public DoubleQueue()
1916 {
1917 }
1918
1919 public virtual int Count
1920 {
1921 get { return m_highQueue.Count + m_lowQueue.Count; }
1922 }
1923
1924 public virtual void Enqueue(T data)
1925 {
1926 Enqueue(m_lowQueue, data);
1927 }
1928
1929 public virtual void EnqueueLow(T data)
1930 {
1931 Enqueue(m_lowQueue, data);
1932 }
1933
1934 public virtual void EnqueueHigh(T data)
1935 {
1936 Enqueue(m_highQueue, data);
1937 }
1938
1939 private void Enqueue(Queue<T> q, T data)
1940 {
1941 lock (m_syncRoot)
1942 {
1943 m_lowQueue.Enqueue(data);
1944 m_s.WaitOne(0);
1945 m_s.Release();
1946 }
1947 }
1948
1949 public virtual T Dequeue()
1950 {
1951 return Dequeue(Timeout.Infinite);
1952 }
1953
1954 public virtual T Dequeue(int tmo)
1955 {
1956 return Dequeue(TimeSpan.FromMilliseconds(tmo));
1957 }
1958
1959 public virtual T Dequeue(TimeSpan wait)
1960 {
1961 T res = null;
1962
1963 if (!Dequeue(wait, ref res))
1964 return null;
1965
1966 return res;
1967 }
1968
1969 public bool Dequeue(int timeout, ref T res)
1970 {
1971 return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res);
1972 }
1973
1974 public bool Dequeue(TimeSpan wait, ref T res)
1975 {
1976 if (!m_s.WaitOne(wait))
1977 return false;
1978
1979 lock (m_syncRoot)
1980 {
1981 if (m_highQueue.Count > 0)
1982 res = m_highQueue.Dequeue();
1983 else
1984 res = m_lowQueue.Dequeue();
1985
1986 if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
1987 return true;
1988
1989 try
1990 {
1991 m_s.Release();
1992 }
1993 catch
1994 {
1995 }
1996
1997 return true;
1998 }
1999 }
2000
2001 public virtual void Clear()
2002 {
2003
2004 lock (m_syncRoot)
2005 {
2006 // Make sure sem count is 0
2007 m_s.WaitOne(0);
2008
2009 m_lowQueue.Clear();
2010 m_highQueue.Clear();
2011 }
2012 }
2013 }
2014} 1906}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c7a38f7..e58aadc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2970,6 +2970,13 @@ namespace OpenSim.Region.Framework.Scenes
2970 SubscribeToClientEvents(client); 2970 SubscribeToClientEvents(client);
2971 2971
2972 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); 2972 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
2973 InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46);
2974 if (cof == null)
2975 sp.COF = UUID.Zero;
2976 else
2977 sp.COF = cof.ID;
2978
2979 m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF);
2973 m_eventManager.TriggerOnNewPresence(sp); 2980 m_eventManager.TriggerOnNewPresence(sp);
2974 2981
2975 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; 2982 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 471caa2..91f9c0b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -443,6 +443,8 @@ namespace OpenSim.Region.Framework.Scenes
443 get { return (IClientCore)ControllingClient; } 443 get { return (IClientCore)ControllingClient; }
444 } 444 }
445 445
446 public UUID COF { get; set; }
447
446// public Vector3 ParentPosition { get; set; } 448// public Vector3 ParentPosition { get; set; }
447 449
448 /// <summary> 450 /// <summary>
diff --git a/prebuild.xml b/prebuild.xml
index fa21722..fba7b27 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1597,9 +1597,10 @@
1597 <Reference name="System.Drawing"/> 1597 <Reference name="System.Drawing"/>
1598 <Reference name="System.Xml"/> 1598 <Reference name="System.Xml"/>
1599 <Reference name="System.Web"/> 1599 <Reference name="System.Web"/>
1600 <Reference name="OpenMetaverse" path="../../../../../bin/"/>
1600 <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/> 1601 <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/>
1601 <Reference name="OpenMetaverse.StructuredData" path="../../../../../bin/"/> 1602 <Reference name="OpenMetaverse.StructuredData" path="../../../../../bin/"/>
1602 <Reference name="OpenMetaverse" path="../../../../../bin/"/> 1603
1603 <Reference name="OpenSim.Region.Framework"/> 1604 <Reference name="OpenSim.Region.Framework"/>
1604 <Reference name="OpenSim.Capabilities"/> 1605 <Reference name="OpenSim.Capabilities"/>
1605 <Reference name="OpenSim.Capabilities.Handlers"/> 1606 <Reference name="OpenSim.Capabilities.Handlers"/>