diff options
author | Melanie | 2013-02-07 21:26:55 +0000 |
---|---|---|
committer | Melanie | 2013-02-07 21:26:55 +0000 |
commit | 8b78b9429d049d1b18a15d3f558e241c785ae5b3 (patch) | |
tree | 7b0c8fec3c6fbb04ab60f9402df8013333155cb3 /OpenSim/Region/ClientStack/Linden/Caps | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Rename Bounciness to Restitution (diff) | |
download | opensim-SC_OLD-8b78b9429d049d1b18a15d3f558e241c785ae5b3.zip opensim-SC_OLD-8b78b9429d049d1b18a15d3f558e241c785ae5b3.tar.gz opensim-SC_OLD-8b78b9429d049d1b18a15d3f558e241c785ae5b3.tar.bz2 opensim-SC_OLD-8b78b9429d049d1b18a15d3f558e241c785ae5b3.tar.xz |
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 77 |
1 files changed, 70 insertions, 7 deletions
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; | |||
39 | using OpenSim.Framework.Servers.HttpServer; | 39 | using OpenSim.Framework.Servers.HttpServer; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Framework.Capabilities; | ||
42 | using OpenSim.Services.Interfaces; | 43 | using OpenSim.Services.Interfaces; |
43 | using Caps = OpenSim.Framework.Capabilities.Caps; | 44 | using Caps = OpenSim.Framework.Capabilities.Caps; |
44 | using OpenSim.Capabilities.Handlers; | 45 | using OpenSim.Capabilities.Handlers; |
45 | using OpenSim.Framework.Monitoring; | 46 | using OpenSim.Framework.Monitoring; |
47 | using OpenMetaverse; | ||
48 | using OpenMetaverse.StructuredData; | ||
46 | 49 | ||
47 | namespace OpenSim.Region.ClientStack.Linden | 50 | namespace 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); |