aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-11 18:13:10 +0000
committerJustin Clarke Casey2008-04-11 18:13:10 +0000
commita5176c2e2c4d2791ec15a22db4309bb15bc3ae98 (patch)
treebbadbbd793ebda546831e9541e312d480d5dae0c /OpenSim/Region
parent* fix bug 935 (diff)
downloadopensim-SC_OLD-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.zip
opensim-SC_OLD-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.gz
opensim-SC_OLD-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.bz2
opensim-SC_OLD-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.xz
* Change inventory async response deliver to deliver all items and folders at once, rather than each individual
* This is required in order to work towards eliminating some inventory race conditions and to better deal with situations where a grid inventory server is slow or not responding.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs45
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs40
2 files changed, 41 insertions, 44 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index bb3db9d..13cb6de 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -39,32 +39,38 @@ namespace OpenSim.Region.Communications.Local
39 /// </summary> 39 /// </summary>
40 public class LocalInventoryService : InventoryServiceBase 40 public class LocalInventoryService : InventoryServiceBase
41 { 41 {
42 public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, 42 public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback)
43 InventoryItemInfo itemCallBack)
44 { 43 {
45 List<InventoryFolderBase> folders = GetInventorySkeleton(userID); 44 List<InventoryFolderBase> skeletonFolders = GetInventorySkeleton(userID);
46
47 InventoryFolderImpl rootFolder = null; 45 InventoryFolderImpl rootFolder = null;
46
47 ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
48 ICollection<InventoryItemBase> items = new List<InventoryItemBase>();
48 49
49 //need to make sure we send root folder first 50 // Need to retrieve the root folder on the first pass
50 foreach (InventoryFolderBase folder in folders) 51 foreach (InventoryFolderBase folder in skeletonFolders)
51 { 52 {
52 if (folder.ParentID == LLUUID.Zero) 53 if (folder.ParentID == LLUUID.Zero)
53 { 54 {
54 rootFolder = RequestInventoryFolder(userID, folder, folderCallBack, itemCallBack); 55 //rootFolder = RequestInventoryFolder(userID, folder, callback);
56 rootFolder = new InventoryFolderImpl(folder);
57 folders.Add(rootFolder);
55 } 58 }
56 } 59 }
57 60
58 if (rootFolder != null) 61 if (rootFolder != null)
59 { 62 {
60 foreach (InventoryFolderBase folder in folders) 63 foreach (InventoryFolderBase folder in skeletonFolders)
61 { 64 {
62 if (folder.ID != rootFolder.ID) 65 if (folder.ID != rootFolder.ID)
63 { 66 {
64 RequestInventoryFolder(userID, folder, folderCallBack, itemCallBack); 67 //RequestInventoryFolder(userID, folder, callback);
68 folders.Add(new InventoryFolderImpl(folder));
65 } 69 }
66 } 70 }
67 } 71 }
72
73 callback(userID, folders, items);
68 } 74 }
69 75
70 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) 76 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
@@ -99,26 +105,5 @@ namespace OpenSim.Region.Communications.Local
99 return true; 105 return true;
100 } 106 }
101 } 107 }
102
103 /// <summary>
104 /// Send the given inventory folder and its item contents back to the requester.
105 /// </summary>
106 /// <param name="userID"></param>
107 /// <param name="folder"></param>
108 private InventoryFolderImpl RequestInventoryFolder(LLUUID userID, InventoryFolderBase folder,
109 InventoryFolderInfo folderCallBack,
110 InventoryItemInfo itemCallBack)
111 {
112 InventoryFolderImpl newFolder = new InventoryFolderImpl(folder);
113 folderCallBack(userID, newFolder);
114
115 List<InventoryItemBase> items = RequestFolderItems(newFolder.ID);
116 foreach (InventoryItemBase item in items)
117 {
118 itemCallBack(userID, item);
119 }
120
121 return newFolder;
122 }
123 } 108 }
124} 109}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index b18c5bf..f31127f 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -51,12 +51,11 @@ namespace OpenSim.Region.Communications.OGS1
51 #region IInventoryServices Members 51 #region IInventoryServices Members
52 52
53 // See IInventoryServices 53 // See IInventoryServices
54 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, 54 public void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback)
55 InventoryItemInfo itemCallBack)
56 { 55 {
57 if (!m_RequestingInventory.ContainsKey(userID)) 56 if (!m_RequestingInventory.ContainsKey(userID))
58 { 57 {
59 InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack); 58 InventoryRequest request = new InventoryRequest(userID, callback);
60 m_RequestingInventory.Add(userID, request); 59 m_RequestingInventory.Add(userID, request);
61 RequestInventory(userID); 60 RequestInventory(userID);
62 } 61 }
@@ -105,13 +104,17 @@ namespace OpenSim.Region.Communications.OGS1
105 104
106 InventoryFolderImpl rootFolder = null; 105 InventoryFolderImpl rootFolder = null;
107 InventoryRequest request = m_RequestingInventory[userID]; 106 InventoryRequest request = m_RequestingInventory[userID];
107
108 ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
109 ICollection<InventoryItemBase> items = new List<InventoryItemBase>();
110
108 foreach (InventoryFolderBase folder in response.Folders) 111 foreach (InventoryFolderBase folder in response.Folders)
109 { 112 {
110 if (folder.ParentID == LLUUID.Zero) 113 if (folder.ParentID == LLUUID.Zero)
111 { 114 {
112 InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); 115 rootFolder = new InventoryFolderImpl(folder);
113 rootFolder = newfolder; 116 folders.Add(rootFolder);
114 request.FolderCallBack(userID, newfolder); 117 //request.FolderCallBack(userID, newfolder);
115 } 118 }
116 } 119 }
117 120
@@ -121,16 +124,20 @@ namespace OpenSim.Region.Communications.OGS1
121 { 124 {
122 if (folder.ID != rootFolder.ID) 125 if (folder.ID != rootFolder.ID)
123 { 126 {
124 InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); 127 folders.Add(new InventoryFolderImpl(folder));
125 request.FolderCallBack(userID, newfolder); 128 //request.FolderCallBack(userID, newfolder);
126 } 129 }
127 } 130 }
128 131
129 foreach (InventoryItemBase item in response.AllItems) 132 foreach (InventoryItemBase item in response.AllItems)
130 { 133 {
131 request.ItemCallBack(userID, item); 134 items.Add(item);
135 //request.ItemCallBack(userID, item);
132 } 136 }
133 } 137 }
138
139 request.Callback(userID, folders, items);
140
134 m_RequestingInventory.Remove(userID); 141 m_RequestingInventory.Remove(userID);
135 } 142 }
136 else 143 else
@@ -223,17 +230,22 @@ namespace OpenSim.Region.Communications.OGS1
223 230
224 #endregion 231 #endregion
225 232
233 /// <summary>
234 /// Caches a pending inventory request that has yet to be satisfied by the inventory service
235 /// </summary>
226 public class InventoryRequest 236 public class InventoryRequest
227 { 237 {
228 public LLUUID UserID; 238 public LLUUID UserID;
229 public InventoryFolderInfo FolderCallBack; 239 public InventoryReceiptCallback Callback;
230 public InventoryItemInfo ItemCallBack; 240 //public InventoryFolderInfo FolderCallBack;
241 //public InventoryItemInfo ItemCallBack;
231 242
232 public InventoryRequest(LLUUID userId, InventoryFolderInfo folderCall, InventoryItemInfo itemCall) 243 public InventoryRequest(LLUUID userId, InventoryReceiptCallback callback)
233 { 244 {
234 UserID = userId; 245 UserID = userId;
235 FolderCallBack = folderCall; 246 //FolderCallBack = folderCall;
236 ItemCallBack = itemCall; 247 //ItemCallBack = itemCall;
248 Callback = callback;
237 } 249 }
238 } 250 }
239 } 251 }