HG: close a loophole by which if something was wrong with the ServiceURLs it resulted in never ending asset requests

cpu-performance
Diva Canto 2013-07-02 13:29:44 -07:00
parent 635704b7ef
commit ccca005969
3 changed files with 11 additions and 2 deletions

View File

@ -421,7 +421,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// foreign user is visiting, we need to try again after the first fail to the local // foreign user is visiting, we need to try again after the first fail to the local
// asset service. // asset service.
string assetServerURL = string.Empty; string assetServerURL = string.Empty;
if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL)) if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL) && !string.IsNullOrEmpty(assetServerURL))
{ {
if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("=")) if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("="))
assetServerURL = assetServerURL + "/"; assetServerURL = assetServerURL + "/";

View File

@ -73,6 +73,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
private AssetMetadata FetchMetadata(string url, UUID assetID) private AssetMetadata FetchMetadata(string url, UUID assetID)
{ {
if (string.IsNullOrEmpty(url))
return null;
if (!url.EndsWith("/") && !url.EndsWith("=")) if (!url.EndsWith("/") && !url.EndsWith("="))
url = url + "/"; url = url + "/";
@ -92,6 +95,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
AssetBase asset = m_scene.AssetService.Get(assetID.ToString()); AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
if (asset == null) if (asset == null)
{ {
if (string.IsNullOrEmpty(url))
return null;
if (!url.EndsWith("/") && !url.EndsWith("=")) if (!url.EndsWith("/") && !url.EndsWith("="))
url = url + "/"; url = url + "/";
@ -109,6 +115,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
public bool PostAsset(string url, AssetBase asset) public bool PostAsset(string url, AssetBase asset)
{ {
if (string.IsNullOrEmpty(url))
return false;
if (asset != null) if (asset != null)
{ {
if (!url.EndsWith("/") && !url.EndsWith("=")) if (!url.EndsWith("/") && !url.EndsWith("="))

View File

@ -297,7 +297,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (m_Scene.TryGetScenePresence(userID, out sp)) if (m_Scene.TryGetScenePresence(userID, out sp))
{ {
AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
{ {
assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString();
assetServerURL = assetServerURL.Trim(new char[] { '/' }); assetServerURL = assetServerURL.Trim(new char[] { '/' });