aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Inventory
diff options
context:
space:
mode:
authorDiva Canto2015-05-07 19:24:08 -0700
committerDiva Canto2015-05-07 19:24:08 -0700
commitc74cef0f4261191962959e42c7e349adafd42a04 (patch)
tree95ad098d2606b7d37a6b287816d9f6a02311860d /OpenSim/Server/Handlers/Inventory
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-c74cef0f4261191962959e42c7e349adafd42a04.zip
opensim-SC-c74cef0f4261191962959e42c7e349adafd42a04.tar.gz
opensim-SC-c74cef0f4261191962959e42c7e349adafd42a04.tar.bz2
opensim-SC-c74cef0f4261191962959e42c7e349adafd42a04.tar.xz
Major change in the way inventory is downloaded: added a method throughout IIventoryService that fetches sets of folders at once. Also added folder id in the InventoryCollection data structure, so that we don't need to go to inventory server again just for that. This reduces the chatter between sims and inventory server by... a lot. On my tests, this reduces initial inventory download down to 30% of what it currently is.
Diffstat (limited to 'OpenSim/Server/Handlers/Inventory')
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs74
1 files changed, 72 insertions, 2 deletions
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 0288fa6..4f01e36 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -41,7 +41,9 @@ using OpenSim.Server.Handlers.Base;
41using log4net; 41using log4net;
42using OpenMetaverse; 42using OpenMetaverse;
43 43
44namespace OpenSim.Server.Handlers.Asset 44using System.Threading;
45
46namespace OpenSim.Server.Handlers.Inventory
45{ 47{
46 public class XInventoryInConnector : ServiceConnector 48 public class XInventoryInConnector : ServiceConnector
47 { 49 {
@@ -123,6 +125,8 @@ namespace OpenSim.Server.Handlers.Asset
123 return HandleGetFolderForType(request); 125 return HandleGetFolderForType(request);
124 case "GETFOLDERCONTENT": 126 case "GETFOLDERCONTENT":
125 return HandleGetFolderContent(request); 127 return HandleGetFolderContent(request);
128 case "GETMULTIPLEFOLDERSCONTENT":
129 return HandleGetMultipleFoldersContent(request);
126 case "GETFOLDERITEMS": 130 case "GETFOLDERITEMS":
127 return HandleGetFolderItems(request); 131 return HandleGetFolderItems(request);
128 case "ADDFOLDER": 132 case "ADDFOLDER":
@@ -284,6 +288,8 @@ namespace OpenSim.Server.Handlers.Asset
284 InventoryCollection icoll = m_InventoryService.GetFolderContent(principal, folderID); 288 InventoryCollection icoll = m_InventoryService.GetFolderContent(principal, folderID);
285 if (icoll != null) 289 if (icoll != null)
286 { 290 {
291 result["FID"] = icoll.FolderID.ToString();
292 result["VERSION"] = icoll.Version.ToString();
287 Dictionary<string, object> folders = new Dictionary<string, object>(); 293 Dictionary<string, object> folders = new Dictionary<string, object>();
288 int i = 0; 294 int i = 0;
289 if (icoll.Folders != null) 295 if (icoll.Folders != null)
@@ -314,7 +320,71 @@ namespace OpenSim.Server.Handlers.Asset
314 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 320 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
315 } 321 }
316 322
317 byte[] HandleGetFolderItems(Dictionary<string,object> request) 323 byte[] HandleGetMultipleFoldersContent(Dictionary<string, object> request)
324 {
325 Dictionary<string, object> resultSet = new Dictionary<string, object>();
326 UUID principal = UUID.Zero;
327 UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
328 string folderIDstr = request["FOLDERS"].ToString();
329 int count = 0;
330 Int32.TryParse(request["COUNT"].ToString(), out count);
331
332 UUID[] fids = new UUID[count];
333 string[] uuids = folderIDstr.Split(',');
334 int i = 0;
335 foreach (string id in uuids)
336 {
337 UUID fid = UUID.Zero;
338 if (UUID.TryParse(id, out fid))
339 fids[i] = fid;
340 i += 1;
341 }
342
343 count = 0;
344 InventoryCollection[] icollList = m_InventoryService.GetMultipleFoldersContent(principal, fids);
345 if (icollList != null && icollList.Length > 0)
346 {
347 foreach (InventoryCollection icoll in icollList)
348 {
349 Dictionary<string, object> result = new Dictionary<string, object>();
350 result["FID"] = icoll.FolderID.ToString();
351 result["VERSION"] = icoll.Version.ToString();
352 result["OWNER"] = icoll.OwnerID.ToString();
353 Dictionary<string, object> folders = new Dictionary<string, object>();
354 i = 0;
355 if (icoll.Folders != null)
356 {
357 foreach (InventoryFolderBase f in icoll.Folders)
358 {
359 folders["folder_" + i.ToString()] = EncodeFolder(f);
360 i++;
361 }
362 result["FOLDERS"] = folders;
363 }
364 i = 0;
365 if (icoll.Items != null)
366 {
367 Dictionary<string, object> items = new Dictionary<string, object>();
368 foreach (InventoryItemBase it in icoll.Items)
369 {
370 items["item_" + i.ToString()] = EncodeItem(it);
371 i++;
372 }
373 result["ITEMS"] = items;
374 }
375
376 resultSet["F_" + fids[count++]] = result;
377 //m_log.DebugFormat("[XXX]: Sending {0} {1}", fids[count-1], icoll.FolderID);
378 }
379 }
380
381 string xmlString = ServerUtils.BuildXmlResponse(resultSet);
382
383 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
384 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
385 }
386
387 byte[] HandleGetFolderItems(Dictionary<string, object> request)
318 { 388 {
319 Dictionary<string,object> result = new Dictionary<string,object>(); 389 Dictionary<string,object> result = new Dictionary<string,object>();
320 UUID principal = UUID.Zero; 390 UUID principal = UUID.Zero;