Put the configuration back in FetchInventoryDesc2 cap.

cpu-performance
Diva Canto 2013-06-07 16:00:32 -07:00
parent 664c6191ed
commit 07cc16ff9c
1 changed files with 29 additions and 0 deletions

View File

@ -71,6 +71,11 @@ namespace OpenSim.Region.ClientStack.Linden
private IInventoryService m_InventoryService; private IInventoryService m_InventoryService;
private ILibraryService m_LibraryService; private ILibraryService m_LibraryService;
private bool m_Enabled;
private string m_fetchInventoryDescendents2Url;
private string m_webFetchInventoryDescendentsUrl;
private static WebFetchInvDescHandler m_webFetchHandler; private static WebFetchInvDescHandler m_webFetchHandler;
private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>();
@ -83,15 +88,32 @@ namespace OpenSim.Region.ClientStack.Linden
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig config = source.Configs["ClientStack.LindenCaps"];
if (config == null)
return;
m_fetchInventoryDescendents2Url = config.GetString("Cap_FetchInventoryDescendents2", string.Empty);
m_webFetchInventoryDescendentsUrl = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty);
if (m_fetchInventoryDescendents2Url != string.Empty || m_webFetchInventoryDescendentsUrl != string.Empty)
{
m_Enabled = true;
}
} }
public void AddRegion(Scene s) public void AddRegion(Scene s)
{ {
if (!m_Enabled)
return;
m_scene = s; m_scene = s;
} }
public void RemoveRegion(Scene s) public void RemoveRegion(Scene s)
{ {
if (!m_Enabled)
return;
m_scene.EventManager.OnRegisterCaps -= RegisterCaps; m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
m_scene = null; m_scene = null;
@ -99,6 +121,9 @@ namespace OpenSim.Region.ClientStack.Linden
public void RegionLoaded(Scene s) public void RegionLoaded(Scene s)
{ {
if (!m_Enabled)
return;
m_InventoryService = m_scene.InventoryService; m_InventoryService = m_scene.InventoryService;
m_LibraryService = m_scene.LibraryService; m_LibraryService = m_scene.LibraryService;
@ -283,6 +308,9 @@ namespace OpenSim.Region.ClientStack.Linden
private void RegisterCaps(UUID agentID, Caps caps) private void RegisterCaps(UUID agentID, Caps caps)
{ {
if (m_fetchInventoryDescendents2Url == "")
return;
string capUrl = "/CAPS/" + UUID.Random() + "/"; string capUrl = "/CAPS/" + UUID.Random() + "/";
// Register this as a poll service // Register this as a poll service
@ -300,6 +328,7 @@ namespace OpenSim.Region.ClientStack.Linden
port = MainServer.Instance.SSLPort; port = MainServer.Instance.SSLPort;
protocol = "https"; protocol = "https";
} }
caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
m_capsDict[agentID] = capUrl; m_capsDict[agentID] = capUrl;