diff options
author | Justin Clark-Casey (justincc) | 2011-09-07 23:16:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-09-07 23:16:19 +0100 |
commit | 7cadb89a0f5a298beda619c395c0810ca198a718 (patch) | |
tree | 67c5a761d3626593e0f9939dc530c902ef4d7ca7 /OpenSim | |
parent | Add temporary debugging in HGInventoryBroker and RemoveXInventoryServiceConne... (diff) | |
download | opensim-SC-7cadb89a0f5a298beda619c395c0810ca198a718.zip opensim-SC-7cadb89a0f5a298beda619c395c0810ca198a718.tar.gz opensim-SC-7cadb89a0f5a298beda619c395c0810ca198a718.tar.bz2 opensim-SC-7cadb89a0f5a298beda619c395c0810ca198a718.tar.xz |
When a region is added to the HG Inventory Broker, also pass this through to the embedded local inventory connector to prevent an NRE when that connector tries to lookup the UserManager through the scene.
This is to address http://opensimulator.org/mantis/view.php?id=5669
However, if this failure was happening I'm kind of surprised that local HG inventory was working at all.....
We probably weren't seeing these exceptions previously because we weren't logging them when the reached the top of a FireAndForget thread.
Diffstat (limited to 'OpenSim')
3 files changed, 41 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index d9d7318..0d121ed 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -148,8 +148,29 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
148 | 148 | ||
149 | scene.RegisterModuleInterface<IInventoryService>(this); | 149 | scene.RegisterModuleInterface<IInventoryService>(this); |
150 | 150 | ||
151 | scene.EventManager.OnClientClosed += OnClientClosed; | 151 | if (m_Scenes.Count == 1) |
152 | { | ||
153 | // FIXME: The local connector needs the scene to extract the UserManager. However, it's not enabled so | ||
154 | // we can't just add the region. But this approach is super-messy. | ||
155 | if (m_LocalGridInventoryService is RemoteXInventoryServicesConnector) | ||
156 | { | ||
157 | m_log.DebugFormat( | ||
158 | "[HG INVENTORY BROKER]: Manually setting scene in RemoteXInventoryServicesConnector to {0}", | ||
159 | scene.RegionInfo.RegionName); | ||
160 | |||
161 | ((RemoteXInventoryServicesConnector)m_LocalGridInventoryService).Scene = scene; | ||
162 | } | ||
163 | else if (m_LocalGridInventoryService is LocalInventoryServicesConnector) | ||
164 | { | ||
165 | m_log.DebugFormat( | ||
166 | "[HG INVENTORY BROKER]: Manually setting scene in LocalInventoryServicesConnector to {0}", | ||
167 | scene.RegionInfo.RegionName); | ||
168 | |||
169 | ((LocalInventoryServicesConnector)m_LocalGridInventoryService).Scene = scene; | ||
170 | } | ||
152 | 171 | ||
172 | scene.EventManager.OnClientClosed += OnClientClosed; | ||
173 | } | ||
153 | } | 174 | } |
154 | 175 | ||
155 | public void RemoveRegion(Scene scene) | 176 | public void RemoveRegion(Scene scene) |
@@ -586,7 +607,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
586 | else | 607 | else |
587 | { | 608 | { |
588 | RemoteXInventoryServicesConnector rxisc = new RemoteXInventoryServicesConnector(url); | 609 | RemoteXInventoryServicesConnector rxisc = new RemoteXInventoryServicesConnector(url); |
589 | rxisc.UserManager = UserManagementModule; | 610 | rxisc.Scene = m_Scenes[0]; |
590 | connector = rxisc; | 611 | connector = rxisc; |
591 | } | 612 | } |
592 | 613 | ||
@@ -597,4 +618,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
597 | return connector; | 618 | return connector; |
598 | } | 619 | } |
599 | } | 620 | } |
600 | } | 621 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 65e39c0..d3ef08d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -47,9 +47,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
48 | MethodBase.GetCurrentMethod().DeclaringType); | 48 | MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | private IInventoryService m_InventoryService; | 50 | /// <summary> |
51 | /// Scene used by this module. This currently needs to be publicly settable for HGInventoryBroker. | ||
52 | /// </summary> | ||
53 | public Scene Scene { get; set; } | ||
51 | 54 | ||
52 | private Scene m_Scene; | 55 | private IInventoryService m_InventoryService; |
53 | 56 | ||
54 | private IUserManagement m_UserManager; | 57 | private IUserManagement m_UserManager; |
55 | private IUserManagement UserManager | 58 | private IUserManagement UserManager |
@@ -58,7 +61,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
58 | { | 61 | { |
59 | if (m_UserManager == null) | 62 | if (m_UserManager == null) |
60 | { | 63 | { |
61 | m_UserManager = m_Scene.RequestModuleInterface<IUserManagement>(); | 64 | m_UserManager = Scene.RequestModuleInterface<IUserManagement>(); |
62 | } | 65 | } |
63 | return m_UserManager; | 66 | return m_UserManager; |
64 | } | 67 | } |
@@ -131,8 +134,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
131 | 134 | ||
132 | scene.RegisterModuleInterface<IInventoryService>(this); | 135 | scene.RegisterModuleInterface<IInventoryService>(this); |
133 | 136 | ||
134 | if (m_Scene == null) | 137 | if (Scene == null) |
135 | m_Scene = scene; | 138 | Scene = scene; |
136 | } | 139 | } |
137 | 140 | ||
138 | public void RemoveRegion(Scene scene) | 141 | public void RemoveRegion(Scene scene) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 97fdd4e..eb90774 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -45,6 +45,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
45 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | /// <summary> | ||
49 | /// Scene used by this module. This currently needs to be publicly settable for HGInventoryBroker. | ||
50 | /// </summary> | ||
51 | public Scene Scene { get; set; } | ||
52 | |||
48 | private bool m_Enabled = false; | 53 | private bool m_Enabled = false; |
49 | private Scene m_Scene; | 54 | private Scene m_Scene; |
50 | private XInventoryServicesConnector m_RemoteConnector; | 55 | private XInventoryServicesConnector m_RemoteConnector; |
@@ -56,24 +61,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
56 | { | 61 | { |
57 | if (m_UserManager == null) | 62 | if (m_UserManager == null) |
58 | { | 63 | { |
59 | m_UserManager = m_Scene.RequestModuleInterface<IUserManagement>(); | 64 | m_UserManager = Scene.RequestModuleInterface<IUserManagement>(); |
60 | 65 | ||
61 | if (m_UserManager == null) | 66 | if (m_UserManager == null) |
62 | m_log.ErrorFormat( | 67 | m_log.ErrorFormat( |
63 | "[XINVENTORY CONNECTOR]: Could not retrieve IUserManagement module from {0}", | 68 | "[XINVENTORY CONNECTOR]: Could not retrieve IUserManagement module from {0}", |
64 | m_Scene.RegionInfo.RegionName); | 69 | Scene.RegionInfo.RegionName); |
65 | } | 70 | } |
66 | 71 | ||
67 | return m_UserManager; | 72 | return m_UserManager; |
68 | } | 73 | } |
69 | |||
70 | set | ||
71 | { | ||
72 | m_log.WarnFormat( | ||
73 | "[XINVENTORY CONNECTOR]: Manually setting UserManager {0} (scene {1})", value, m_Scene); | ||
74 | |||
75 | m_UserManager = value; | ||
76 | } | ||
77 | } | 74 | } |
78 | 75 | ||
79 | public Type ReplaceableInterface | 76 | public Type ReplaceableInterface |
@@ -141,15 +138,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
141 | 138 | ||
142 | scene.RegisterModuleInterface<IInventoryService>(this); | 139 | scene.RegisterModuleInterface<IInventoryService>(this); |
143 | 140 | ||
144 | if (m_Scene == null) | 141 | if (Scene == null) |
145 | m_Scene = scene; | 142 | Scene = scene; |
146 | } | 143 | } |
147 | 144 | ||
148 | public void RemoveRegion(Scene scene) | 145 | public void RemoveRegion(Scene scene) |
149 | { | 146 | { |
150 | if (!m_Enabled) | 147 | if (!m_Enabled) |
151 | return; | 148 | return; |
152 | |||
153 | } | 149 | } |
154 | 150 | ||
155 | public void RegionLoaded(Scene scene) | 151 | public void RegionLoaded(Scene scene) |