aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs70
1 files changed, 37 insertions, 33 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 48f228a..7a4f981 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
86 } 86 }
87 } 87 }
88 88
89 public Type ReplaceableInterface 89 public Type ReplaceableInterface
90 { 90 {
91 get { return null; } 91 get { return null; }
92 } 92 }
@@ -203,21 +203,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
203 203
204 void OnClientClosed(UUID clientID, Scene scene) 204 void OnClientClosed(UUID clientID, Scene scene)
205 { 205 {
206 if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache 206 ScenePresence sp = null;
207 foreach (Scene s in m_Scenes)
207 { 208 {
208 ScenePresence sp = null; 209 s.TryGetScenePresence(clientID, out sp);
209 foreach (Scene s in m_Scenes) 210 if ((sp != null) && !sp.IsChildAgent && (s != scene))
210 { 211 {
211 s.TryGetScenePresence(clientID, out sp); 212 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache",
212 if ((sp != null) && !sp.IsChildAgent && (s != scene))
213 {
214 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache",
215 scene.RegionInfo.RegionName, clientID); 213 scene.RegionInfo.RegionName, clientID);
216 return; 214 return;
217 }
218 } 215 }
219 DropInventoryServiceURL(clientID);
220 } 216 }
217
218 if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache
219 DropInventoryServiceURL(clientID);
220
221 m_Cache.RemoveAll(clientID);
221 } 222 }
222 223
223 /// <summary> 224 /// <summary>
@@ -249,7 +250,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
249 if (inventoryURL != null && inventoryURL != string.Empty) 250 if (inventoryURL != null && inventoryURL != string.Empty)
250 { 251 {
251 inventoryURL = inventoryURL.Trim(new char[] { '/' }); 252 inventoryURL = inventoryURL.Trim(new char[] { '/' });
252 m_InventoryURLs[userID] = inventoryURL; 253 lock (m_InventoryURLs)
254 m_InventoryURLs[userID] = inventoryURL;
253 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL); 255 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL);
254 return; 256 return;
255 } 257 }
@@ -267,38 +269,45 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
267 if (!string.IsNullOrEmpty(inventoryURL)) 269 if (!string.IsNullOrEmpty(inventoryURL))
268 { 270 {
269 inventoryURL = inventoryURL.Trim(new char[] { '/' }); 271 inventoryURL = inventoryURL.Trim(new char[] { '/' });
270 m_InventoryURLs.Add(userID, inventoryURL); 272 lock (m_InventoryURLs)
273 m_InventoryURLs[userID] = inventoryURL;
271 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL); 274 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL);
272 } 275 }
273
274 } 276 }
275
276 } 277 }
277 } 278 }
278 279
279 private void DropInventoryServiceURL(UUID userID) 280 private void DropInventoryServiceURL(UUID userID)
280 { 281 {
281 lock (m_InventoryURLs) 282 lock (m_InventoryURLs)
283 {
282 if (m_InventoryURLs.ContainsKey(userID)) 284 if (m_InventoryURLs.ContainsKey(userID))
283 { 285 {
284 string url = m_InventoryURLs[userID]; 286 string url = m_InventoryURLs[userID];
285 m_InventoryURLs.Remove(userID); 287 m_InventoryURLs.Remove(userID);
286 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Removed {0} from the cache of inventory URLs", url); 288 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Removed {0} from the cache of inventory URLs", url);
287 } 289 }
290 }
288 } 291 }
289 292
290 public string GetInventoryServiceURL(UUID userID) 293 public string GetInventoryServiceURL(UUID userID)
291 { 294 {
292 if (m_InventoryURLs.ContainsKey(userID)) 295 lock (m_InventoryURLs)
293 return m_InventoryURLs[userID]; 296 {
297 if (m_InventoryURLs.ContainsKey(userID))
298 return m_InventoryURLs[userID];
299 }
294 300
295 CacheInventoryServiceURL(userID); 301 CacheInventoryServiceURL(userID);
296 302
297 if (m_InventoryURLs.ContainsKey(userID)) 303 lock (m_InventoryURLs)
298 return m_InventoryURLs[userID]; 304 {
305 if (m_InventoryURLs.ContainsKey(userID))
306 return m_InventoryURLs[userID];
307 }
299 308
300 return null; //it means that the methods should forward to local grid's inventory 309 return null; //it means that the methods should forward to local grid's inventory
301 310
302 } 311 }
303 #endregion 312 #endregion
304 313
@@ -598,21 +607,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
598 return connector.DeleteItems(ownerID, itemIDs); 607 return connector.DeleteItems(ownerID, itemIDs);
599 } 608 }
600 609
601 public InventoryItemBase GetItem(InventoryItemBase item) 610 public InventoryItemBase GetItem(UUID principalID, UUID itemID)
602 { 611 {
603 if (item == null)
604 return null;
605 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID); 612 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
606 613
607 string invURL = GetInventoryServiceURL(item.Owner); 614 string invURL = GetInventoryServiceURL(principalID);
608 615
609 if (invURL == null) // not there, forward to local inventory connector to resolve 616 if (invURL == null) // not there, forward to local inventory connector to resolve
610 lock (m_Lock) 617 lock (m_Lock)
611 return m_LocalGridInventoryService.GetItem(item); 618 return m_LocalGridInventoryService.GetItem(principalID, itemID);
612 619
613 IInventoryService connector = GetConnector(invURL); 620 IInventoryService connector = GetConnector(invURL);
614 621
615 return connector.GetItem(item); 622 return connector.GetItem(principalID, itemID);
616 } 623 }
617 624
618 public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs) 625 public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs)
@@ -632,22 +639,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
632 return connector.GetMultipleItems(userID, itemIDs); 639 return connector.GetMultipleItems(userID, itemIDs);
633 } 640 }
634 641
635 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 642 public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
636 { 643 {
637 if (folder == null)
638 return null;
639
640 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID); 644 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
641 645
642 string invURL = GetInventoryServiceURL(folder.Owner); 646 string invURL = GetInventoryServiceURL(principalID);
643 647
644 if (invURL == null) // not there, forward to local inventory connector to resolve 648 if (invURL == null) // not there, forward to local inventory connector to resolve
645 lock (m_Lock) 649 lock (m_Lock)
646 return m_LocalGridInventoryService.GetFolder(folder); 650 return m_LocalGridInventoryService.GetFolder(principalID, folderID);
647 651
648 IInventoryService connector = GetConnector(invURL); 652 IInventoryService connector = GetConnector(invURL);
649 653
650 return connector.GetFolder(folder); 654 return connector.GetFolder(principalID, folderID);
651 } 655 }
652 656
653 public bool HasInventoryForUser(UUID userID) 657 public bool HasInventoryForUser(UUID userID)
@@ -710,4 +714,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
710 return connector; 714 return connector;
711 } 715 }
712 } 716 }
713} \ No newline at end of file 717}