Bug fix: change HGBroker to a INonSharedRegionModule

slimupdates
Diva Canto 2010-01-30 15:43:10 -08:00
parent 42f978a478
commit a0d79e621c
3 changed files with 82 additions and 71 deletions

View File

@ -183,7 +183,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
public bool IsForeignUser(UUID userID, out string assetServerURL) public bool IsForeignUser(UUID userID, out string assetServerURL)
{ {
assetServerURL = string.Empty; assetServerURL = string.Empty;
UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); UserAccount account = null;
if (m_Scene.UserAccountService != null)
account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
if (account == null) // foreign if (account == null) // foreign
{ {
ScenePresence sp = null; ScenePresence sp = null;
@ -193,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
{ {
assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString();
return true; assetServerURL = assetServerURL.Trim(new char[] { '/' }); return true;
} }
} }
} }

View File

@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
public abstract class BaseInventoryConnector : IInventoryService public abstract class BaseInventoryConnector : IInventoryService
{ {
protected InventoryCache m_cache; protected static InventoryCache m_cache;
private static bool m_Initialized;
protected virtual void Init(IConfigSource source) protected virtual void Init(IConfigSource source)
{
if (!m_Initialized)
{ {
m_cache = new InventoryCache(); m_cache = new InventoryCache();
m_cache.Init(source, this); m_cache.Init(source, this);
m_Initialized = true;
}
} }
/// <summary> /// <summary>

View File

@ -41,20 +41,21 @@ using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
public class HGInventoryBroker : BaseInventoryConnector, ISharedRegionModule, IInventoryService public class HGInventoryBroker : BaseInventoryConnector, INonSharedRegionModule, IInventoryService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Enabled = false; private static bool m_Initialized = false;
private bool m_Initialized = false; private static bool m_Enabled = false;
private static IInventoryService m_GridService;
private static ISessionAuthInventoryService m_HGService;
private Scene m_Scene; private Scene m_Scene;
private IUserAccountService m_UserAccountService; private IUserAccountService m_UserAccountService;
private IInventoryService m_GridService;
private ISessionAuthInventoryService m_HGService;
public Type ReplaceableInterface public Type ReplaceableInterface
{ {
get { return null; } get { return null; }
@ -66,6 +67,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{
if (!m_Initialized)
{ {
IConfig moduleConfig = source.Configs["Modules"]; IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null) if (moduleConfig != null)
@ -125,6 +128,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled");
} }
} }
m_Initialized = true;
}
} }
public void PostInitialise() public void PostInitialise()
@ -140,14 +145,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
if (!m_Enabled) if (!m_Enabled)
return; return;
if (!m_Initialized)
{
m_Scene = scene; m_Scene = scene;
m_UserAccountService = m_Scene.UserAccountService; m_UserAccountService = m_Scene.UserAccountService;
m_Initialized = true;
}
scene.RegisterModuleInterface<IInventoryService>(this); scene.RegisterModuleInterface<IInventoryService>(this);
m_cache.AddRegion(scene); m_cache.AddRegion(scene);
} }
@ -514,7 +514,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
private bool IsForeignUser(UUID userID, out string inventoryURL) private bool IsForeignUser(UUID userID, out string inventoryURL)
{ {
inventoryURL = string.Empty; inventoryURL = string.Empty;
UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); UserAccount account = null;
if (m_Scene.UserAccountService != null)
account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
if (account == null) // foreign user if (account == null) // foreign user
{ {
ScenePresence sp = null; ScenePresence sp = null;