Implement the FetchInventoryDescendents2 capability using the same code as WebFetchInventoryDescendents.

Enabling this by setting Cap_FetchInventoryDescendents2 = "localhost" in the [ClientStack.LindenCaps] section of OpenSim.ini downloads inventory via http rather than udp in later viewers.
iar_mods
Justin Clark-Casey (justincc) 2011-11-25 22:46:42 +00:00
parent b785f204ce
commit 676d32974a
3 changed files with 47 additions and 23 deletions

View File

@ -117,7 +117,6 @@ namespace OpenSim.Capabilities.Handlers
response += inventoryitemstr; response += inventoryitemstr;
} }
if (response.Length == 0) if (response.Length == 0)
{ {
// Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants.
@ -135,6 +134,7 @@ namespace OpenSim.Capabilities.Handlers
//m_log.Debug("[CAPS] "+response); //m_log.Debug("[CAPS] "+response);
} }
return response; return response;
} }

View File

@ -42,18 +42,24 @@ using OpenSim.Capabilities.Handlers;
namespace OpenSim.Region.ClientStack.Linden namespace OpenSim.Region.ClientStack.Linden
{ {
/// <summary>
/// This module implements both WebFetchInventoryDescendents and FetchInventoryDescendents2 capabilities.
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class WebFetchInvDescModule : INonSharedRegionModule public class WebFetchInvDescModule : INonSharedRegionModule
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene; private Scene m_scene;
private IInventoryService m_InventoryService; private IInventoryService m_InventoryService;
private ILibraryService m_LibraryService; private ILibraryService m_LibraryService;
private bool m_Enabled = false;
private string m_URL; private bool m_Enabled;
private string m_fetchInventoryDescendents2Url;
private string m_webFetchInventoryDescendentsUrl;
#region ISharedRegionModule Members #region ISharedRegionModule Members
@ -63,9 +69,10 @@ namespace OpenSim.Region.ClientStack.Linden
if (config == null) if (config == null)
return; return;
m_URL = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty); m_fetchInventoryDescendents2Url = config.GetString("Cap_FetchInventoryDescendents2", string.Empty);
// Cap doesn't exist m_webFetchInventoryDescendentsUrl = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty);
if (m_URL != string.Empty)
if (m_fetchInventoryDescendents2Url != string.Empty || m_webFetchInventoryDescendentsUrl != string.Empty)
m_Enabled = true; m_Enabled = true;
} }
@ -111,26 +118,40 @@ namespace OpenSim.Region.ClientStack.Linden
#endregion #endregion
public void RegisterCaps(UUID agentID, Caps caps) private void RegisterCaps(UUID agentID, Caps caps)
{ {
UUID capID = UUID.Random(); UUID capID = UUID.Random();
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_webFetchInventoryDescendentsUrl != "")
if (m_URL == "localhost") RegisterFetchCap(agentID, caps, "WebFetchInventoryDescendents", m_webFetchInventoryDescendentsUrl);
else if (m_fetchInventoryDescendents2Url != "")
RegisterFetchCap(agentID, caps, "FetchInventoryDescendents2", m_fetchInventoryDescendents2Url);
}
private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url)
{
string capUrl;
if (url == "localhost")
{ {
m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); capUrl = "/CAPS/" + UUID.Random();
WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), webFetchHandler.FetchInventoryDescendentsRequest); IRequestHandler reqHandler
caps.RegisterHandler("WebFetchInventoryDescendents", reqHandler); = new RestStreamHandler("POST", capUrl, webFetchHandler.FetchInventoryDescendentsRequest);
// caps.RegisterHandler("FetchInventoryDescendents2", reqHandler);
caps.RegisterHandler(capName, reqHandler);
} }
else else
{ {
m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); capUrl = url;
caps.RegisterHandler("WebFetchInventoryDescendents", m_URL);
// caps.RegisterHandler("FetchInventoryDescendents2", m_URL);
}
}
caps.RegisterHandler(capName, capUrl);
}
// m_log.DebugFormat(
// "[WEB FETCH INV DESC MODULE]: Registered capability {0} at {1} in region {2} for {3}",
// capName, capUrl, m_scene.RegionInfo.RegionName, agentID);
}
} }
} }

View File

@ -573,11 +573,14 @@
Cap_UploadObjectAsset = "localhost" Cap_UploadObjectAsset = "localhost"
Cap_ViewerStartAuction = "" Cap_ViewerStartAuction = ""
Cap_ViewerStats = "" Cap_ViewerStats = ""
; This last one is supported by OpenSim, but may
; lead to poor sim performance if served by the simulators,
; so it is disabled by default.
Cap_WebFetchInventoryDescendents = ""
; The fetch inventory descendents caps are supported by OpenSim, but may
; lead to poor sim performance if served by the simulators,
; so they are disabled by default.
; FetchInventoryDescendents2 is the one used in the latest Linden Lab viewers (from some point in the v2 series and above)
Cap_WebFetchInventoryDescendents = ""
Cap_FetchInventoryDescendents2 = ""
[Chat] [Chat]
; Controls whether the chat module is enabled. Default is true. ; Controls whether the chat module is enabled. Default is true.