aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Inventory
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Services/Connectors/Inventory
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Services/Connectors/Inventory')
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs62
1 files changed, 43 insertions, 19 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
index 7cecd93..dcf25ad 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
@@ -54,6 +54,8 @@ namespace OpenSim.Services.Connectors
54 54
55 private string m_ServerURI = String.Empty; 55 private string m_ServerURI = String.Empty;
56 56
57 private int m_maxRetries = 0;
58
57 /// <summary> 59 /// <summary>
58 /// Timeout for remote requests. 60 /// Timeout for remote requests.
59 /// </summary> 61 /// </summary>
@@ -61,6 +63,7 @@ namespace OpenSim.Services.Connectors
61 /// In this case, -1 is default timeout (100 seconds), not infinite. 63 /// In this case, -1 is default timeout (100 seconds), not infinite.
62 /// </remarks> 64 /// </remarks>
63 private int m_requestTimeoutSecs = -1; 65 private int m_requestTimeoutSecs = -1;
66 private string m_configName = "InventoryService";
64 67
65 private const double CACHE_EXPIRATION_SECONDS = 20.0; 68 private const double CACHE_EXPIRATION_SECONDS = 20.0;
66 private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache = new ExpiringCache<UUID,InventoryItemBase>(); 69 private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache = new ExpiringCache<UUID,InventoryItemBase>();
@@ -74,6 +77,13 @@ namespace OpenSim.Services.Connectors
74 m_ServerURI = serverURI.TrimEnd('/'); 77 m_ServerURI = serverURI.TrimEnd('/');
75 } 78 }
76 79
80 public XInventoryServicesConnector(IConfigSource source, string configName)
81 : base(source, configName)
82 {
83 m_configName = configName;
84 Initialise(source);
85 }
86
77 public XInventoryServicesConnector(IConfigSource source) 87 public XInventoryServicesConnector(IConfigSource source)
78 : base(source, "InventoryService") 88 : base(source, "InventoryService")
79 { 89 {
@@ -82,10 +92,10 @@ namespace OpenSim.Services.Connectors
82 92
83 public virtual void Initialise(IConfigSource source) 93 public virtual void Initialise(IConfigSource source)
84 { 94 {
85 IConfig config = source.Configs["InventoryService"]; 95 IConfig config = source.Configs[m_configName];
86 if (config == null) 96 if (config == null)
87 { 97 {
88 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); 98 m_log.ErrorFormat("[INVENTORY CONNECTOR]: {0} missing from OpenSim.ini", m_configName);
89 throw new Exception("Inventory connector init error"); 99 throw new Exception("Inventory connector init error");
90 } 100 }
91 101
@@ -100,16 +110,17 @@ namespace OpenSim.Services.Connectors
100 m_ServerURI = serviceURI; 110 m_ServerURI = serviceURI;
101 111
102 m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs); 112 m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs);
113 m_maxRetries = config.GetInt("MaxRetries", m_maxRetries);
103 114
104 StatsManager.RegisterStat( 115 StatsManager.RegisterStat(
105 new Stat( 116 new Stat(
106 "RequestsMade", 117 "RequestsMade",
107 "Requests made", 118 "Requests made",
108 "Number of requests made to the remove inventory service", 119 "Number of requests made to the remove inventory service",
109 "requests", 120 "requests",
110 "inventory", 121 "inventory",
111 serviceURI, 122 serviceURI,
112 StatType.Pull, 123 StatType.Pull,
113 MeasuresOfInterest.AverageChangeOverTime, 124 MeasuresOfInterest.AverageChangeOverTime,
114 s => s.Value = RequestsMade, 125 s => s.Value = RequestsMade,
115 StatVerbosity.Debug)); 126 StatVerbosity.Debug));
@@ -240,7 +251,7 @@ namespace OpenSim.Services.Connectors
240 251
241 return inventory; 252 return inventory;
242 } 253 }
243 254
244 public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs) 255 public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs)
245 { 256 {
246 InventoryCollection[] inventoryArr = new InventoryCollection[folderIDs.Length]; 257 InventoryCollection[] inventoryArr = new InventoryCollection[folderIDs.Length];
@@ -520,10 +531,10 @@ namespace OpenSim.Services.Connectors
520 return CheckReturn(ret); 531 return CheckReturn(ret);
521 } 532 }
522 533
523 public InventoryItemBase GetItem(InventoryItemBase item) 534 public InventoryItemBase GetItem(UUID principalID, UUID itemID)
524 { 535 {
525 InventoryItemBase retrieved = null; 536 InventoryItemBase retrieved = null;
526 if (m_ItemCache.TryGetValue(item.ID, out retrieved)) 537 if (m_ItemCache.TryGetValue(itemID, out retrieved))
527 { 538 {
528 return retrieved; 539 return retrieved;
529 } 540 }
@@ -532,7 +543,8 @@ namespace OpenSim.Services.Connectors
532 { 543 {
533 Dictionary<string, object> ret = MakeRequest("GETITEM", 544 Dictionary<string, object> ret = MakeRequest("GETITEM",
534 new Dictionary<string, object> { 545 new Dictionary<string, object> {
535 { "ID", item.ID.ToString() } 546 { "ID", itemID.ToString() },
547 { "PRINCIPAL", principalID.ToString() }
536 }); 548 });
537 549
538 if (!CheckReturn(ret)) 550 if (!CheckReturn(ret))
@@ -545,7 +557,7 @@ namespace OpenSim.Services.Connectors
545 m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e); 557 m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e);
546 } 558 }
547 559
548 m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); 560 m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS);
549 561
550 return retrieved; 562 return retrieved;
551 } 563 }
@@ -559,6 +571,7 @@ namespace OpenSim.Services.Connectors
559 List<UUID> pending = new List<UUID>(); 571 List<UUID> pending = new List<UUID>();
560 InventoryItemBase item = null; 572 InventoryItemBase item = null;
561 int i = 0; 573 int i = 0;
574
562 foreach (UUID id in itemIDs) 575 foreach (UUID id in itemIDs)
563 { 576 {
564 if (m_ItemCache.TryGetValue(id, out item)) 577 if (m_ItemCache.TryGetValue(id, out item))
@@ -612,13 +625,14 @@ namespace OpenSim.Services.Connectors
612 return itemArr; 625 return itemArr;
613 } 626 }
614 627
615 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 628 public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
616 { 629 {
617 try 630 try
618 { 631 {
619 Dictionary<string, object> ret = MakeRequest("GETFOLDER", 632 Dictionary<string, object> ret = MakeRequest("GETFOLDER",
620 new Dictionary<string, object> { 633 new Dictionary<string, object> {
621 { "ID", folder.ID.ToString() } 634 { "ID", folderID.ToString() },
635 { "PRINCIPAL", principalID.ToString() }
622 }); 636 });
623 637
624 if (!CheckReturn(ret)) 638 if (!CheckReturn(ret))
@@ -660,7 +674,7 @@ namespace OpenSim.Services.Connectors
660 { "ASSET", assetID.ToString() } 674 { "ASSET", assetID.ToString() }
661 }); 675 });
662 676
663 // We cannot use CheckReturn() here because valid values for RESULT are "false" (in the case of request failure) or an int 677 // We cannot use CheckReturn() here because valid values for RESULT are "false" (in the case of request failure) or an int
664 if (ret == null) 678 if (ret == null)
665 return 0; 679 return 0;
666 680
@@ -697,11 +711,21 @@ namespace OpenSim.Services.Connectors
697 711
698 RequestsMade++; 712 RequestsMade++;
699 713
700 string reply 714 string reply = String.Empty;
701 = SynchronousRestFormsRequester.MakeRequest( 715 int retries = 0;
716
717 do
718 {
719 reply = SynchronousRestFormsRequester.MakeRequest(
702 "POST", m_ServerURI + "/xinventory", 720 "POST", m_ServerURI + "/xinventory",
703 ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth); 721 ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth);
704 722
723 if (reply != String.Empty)
724 break;
725
726 retries++;
727 } while (retries <= m_maxRetries);
728
705 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( 729 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
706 reply); 730 reply);
707 731