diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 540f33a..01be339 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | |||
@@ -41,8 +41,7 @@ using OpenMetaverse; | |||
41 | 41 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid |
43 | { | 43 | { |
44 | public class LocalGridServicesConnector : | 44 | public class LocalGridServicesConnector : ISharedRegionModule, IGridService |
45 | ISharedRegionModule, IGridService | ||
46 | { | 45 | { |
47 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
48 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -51,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
51 | private IGridService m_GridService; | 50 | private IGridService m_GridService; |
52 | private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>(); | 51 | private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>(); |
53 | 52 | ||
54 | private bool m_Enabled = false; | 53 | private bool m_Enabled; |
55 | 54 | ||
56 | public LocalGridServicesConnector() | 55 | public LocalGridServicesConnector() |
57 | { | 56 | { |
@@ -59,7 +58,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
59 | 58 | ||
60 | public LocalGridServicesConnector(IConfigSource source) | 59 | public LocalGridServicesConnector(IConfigSource source) |
61 | { | 60 | { |
62 | m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated"); | 61 | m_log.Debug("[LOCAL GRID SERVICE CONNECTOR]: LocalGridServicesConnector instantiated directly."); |
63 | InitialiseService(source); | 62 | InitialiseService(source); |
64 | } | 63 | } |
65 | 64 | ||
@@ -84,8 +83,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
84 | if (name == Name) | 83 | if (name == Name) |
85 | { | 84 | { |
86 | InitialiseService(source); | 85 | InitialiseService(source); |
87 | m_Enabled = true; | 86 | m_log.Info("[LOCAL GRID SERVICE CONNECTOR]: Local grid connector enabled"); |
88 | m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled"); | ||
89 | } | 87 | } |
90 | } | 88 | } |
91 | } | 89 | } |
@@ -95,7 +93,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
95 | IConfig assetConfig = source.Configs["GridService"]; | 93 | IConfig assetConfig = source.Configs["GridService"]; |
96 | if (assetConfig == null) | 94 | if (assetConfig == null) |
97 | { | 95 | { |
98 | m_log.Error("[LOCAL GRID CONNECTOR]: GridService missing from OpenSim.ini"); | 96 | m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: GridService missing from OpenSim.ini"); |
99 | return; | 97 | return; |
100 | } | 98 | } |
101 | 99 | ||
@@ -104,7 +102,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
104 | 102 | ||
105 | if (serviceDll == String.Empty) | 103 | if (serviceDll == String.Empty) |
106 | { | 104 | { |
107 | m_log.Error("[LOCAL GRID CONNECTOR]: No LocalServiceModule named in section GridService"); | 105 | m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: No LocalServiceModule named in section GridService"); |
108 | return; | 106 | return; |
109 | } | 107 | } |
110 | 108 | ||
@@ -115,16 +113,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
115 | 113 | ||
116 | if (m_GridService == null) | 114 | if (m_GridService == null) |
117 | { | 115 | { |
118 | m_log.Error("[LOCAL GRID CONNECTOR]: Can't load grid service"); | 116 | m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: Can't load grid service"); |
119 | return; | 117 | return; |
120 | } | 118 | } |
119 | |||
120 | m_Enabled = true; | ||
121 | } | 121 | } |
122 | 122 | ||
123 | public void PostInitialise() | 123 | public void PostInitialise() |
124 | { | 124 | { |
125 | // FIXME: We will still add this command even if we aren't enabled since RemoteGridServiceConnector | ||
126 | // will have instantiated us directly. | ||
125 | MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours", | 127 | MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours", |
126 | "show neighbours", | 128 | "show neighbours", |
127 | "Shows the local regions' neighbours", NeighboursCommand); | 129 | "Shows the local regions' neighbours", HandleShowNeighboursCommand); |
128 | } | 130 | } |
129 | 131 | ||
130 | public void Close() | 132 | public void Close() |
@@ -133,17 +135,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
133 | 135 | ||
134 | public void AddRegion(Scene scene) | 136 | public void AddRegion(Scene scene) |
135 | { | 137 | { |
136 | if (m_Enabled) | 138 | if (!m_Enabled) |
137 | scene.RegisterModuleInterface<IGridService>(this); | 139 | return; |
140 | |||
141 | scene.RegisterModuleInterface<IGridService>(this); | ||
138 | 142 | ||
139 | if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) | 143 | if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) |
140 | m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); | 144 | m_log.ErrorFormat("[LOCAL GRID SERVICE CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); |
141 | else | 145 | else |
142 | m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); | 146 | m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); |
143 | } | 147 | } |
144 | 148 | ||
145 | public void RemoveRegion(Scene scene) | 149 | public void RemoveRegion(Scene scene) |
146 | { | 150 | { |
151 | if (!m_Enabled) | ||
152 | return; | ||
153 | |||
147 | m_LocalCache[scene.RegionInfo.RegionID].Clear(); | 154 | m_LocalCache[scene.RegionInfo.RegionID].Clear(); |
148 | m_LocalCache.Remove(scene.RegionInfo.RegionID); | 155 | m_LocalCache.Remove(scene.RegionInfo.RegionID); |
149 | } | 156 | } |
@@ -232,7 +239,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
232 | 239 | ||
233 | #endregion | 240 | #endregion |
234 | 241 | ||
235 | public void NeighboursCommand(string module, string[] cmdparams) | 242 | public void HandleShowNeighboursCommand(string module, string[] cmdparams) |
236 | { | 243 | { |
237 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); | 244 | System.Text.StringBuilder caps = new System.Text.StringBuilder(); |
238 | 245 | ||