aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
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/Communications/OGS1/OGS1InventoryService.cs
parent* fix bug 935 (diff)
downloadopensim-SC-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.zip
opensim-SC-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.gz
opensim-SC-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.bz2
opensim-SC-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 '')
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs40
1 files changed, 26 insertions, 14 deletions
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 }