diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 45 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs | 74 |
2 files changed, 39 insertions, 80 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index d39537d..e237ca2 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -48,16 +48,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private IHypergridService m_HypergridService; | 51 | private bool m_Initialized = false; |
52 | private IHypergridService HyperGridService | ||
53 | { | ||
54 | get | ||
55 | { | ||
56 | if (m_HypergridService == null) | ||
57 | m_HypergridService = m_aScene.RequestModuleInterface<IHypergridService>(); | ||
58 | return m_HypergridService; | ||
59 | } | ||
60 | } | ||
61 | 52 | ||
62 | private GatekeeperServiceConnector m_GatekeeperConnector; | 53 | private GatekeeperServiceConnector m_GatekeeperConnector; |
63 | private IHomeUsersSecurityService m_Security; | 54 | private IHomeUsersSecurityService m_Security; |
@@ -78,7 +69,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
78 | if (name == Name) | 69 | if (name == Name) |
79 | { | 70 | { |
80 | m_agentsInTransit = new List<UUID>(); | 71 | m_agentsInTransit = new List<UUID>(); |
81 | m_GatekeeperConnector = new GatekeeperServiceConnector(); | ||
82 | 72 | ||
83 | IConfig config = source.Configs["HGEntityTransferModule"]; | 73 | IConfig config = source.Configs["HGEntityTransferModule"]; |
84 | if (config != null) | 74 | if (config != null) |
@@ -108,6 +98,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
108 | scene.RegisterModuleInterface<IHomeUsersSecurityService>(m_Security); | 98 | scene.RegisterModuleInterface<IHomeUsersSecurityService>(m_Security); |
109 | } | 99 | } |
110 | 100 | ||
101 | public override void RegionLoaded(Scene scene) | ||
102 | { | ||
103 | base.RegionLoaded(scene); | ||
104 | if (m_Enabled) | ||
105 | if (!m_Initialized) | ||
106 | { | ||
107 | m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); | ||
108 | m_Initialized = true; | ||
109 | } | ||
110 | |||
111 | } | ||
111 | public override void RemoveRegion(Scene scene) | 112 | public override void RemoveRegion(Scene scene) |
112 | { | 113 | { |
113 | base.AddRegion(scene); | 114 | base.AddRegion(scene); |
@@ -122,7 +123,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
122 | 123 | ||
123 | protected override GridRegion GetFinalDestination(GridRegion region) | 124 | protected override GridRegion GetFinalDestination(GridRegion region) |
124 | { | 125 | { |
125 | return HyperGridService.GetHyperlinkRegion(region, region.RegionID); | 126 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID); |
127 | if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | ||
128 | { | ||
129 | return m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); | ||
130 | } | ||
131 | return region; | ||
126 | } | 132 | } |
127 | 133 | ||
128 | protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 134 | protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |
@@ -133,13 +139,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
133 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) | 139 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) |
134 | { | 140 | { |
135 | reason = string.Empty; | 141 | reason = string.Empty; |
136 | if (reg.RegionLocX != finalDestination.RegionLocX || reg.RegionLocY != finalDestination.RegionLocY) | 142 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); |
143 | if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | ||
137 | { | 144 | { |
138 | // this user is going to another grid | 145 | // this user is going to another grid |
139 | reg.RegionName = finalDestination.RegionName; | 146 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination |
140 | reg.RegionID = finalDestination.RegionID; | 147 | GridRegion region = new GridRegion(reg); |
141 | reg.RegionLocX = finalDestination.RegionLocX; | 148 | region.RegionName = finalDestination.RegionName; |
142 | reg.RegionLocY = finalDestination.RegionLocY; | 149 | region.RegionID = finalDestination.RegionID; |
150 | region.RegionLocX = finalDestination.RegionLocX; | ||
151 | region.RegionLocY = finalDestination.RegionLocY; | ||
143 | 152 | ||
144 | // Log their session and remote endpoint in the home users security service | 153 | // Log their session and remote endpoint in the home users security service |
145 | IHomeUsersSecurityService security = sp.Scene.RequestModuleInterface<IHomeUsersSecurityService>(); | 154 | IHomeUsersSecurityService security = sp.Scene.RequestModuleInterface<IHomeUsersSecurityService>(); |
@@ -149,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
149 | // Log them out of this grid | 158 | // Log them out of this grid |
150 | sp.Scene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat); | 159 | sp.Scene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat); |
151 | 160 | ||
152 | return m_GatekeeperConnector.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 161 | return m_GatekeeperConnector.CreateAgent(region, agentCircuit, teleportFlags, out reason); |
153 | } | 162 | } |
154 | 163 | ||
155 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 164 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs index 07f3cdc..67eae87 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs | |||
@@ -48,7 +48,7 @@ using Nini.Config; | |||
48 | 48 | ||
49 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | 49 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid |
50 | { | 50 | { |
51 | public class HGGridConnector : ISharedRegionModule, IGridService, IHypergridService | 51 | public class HGGridConnector : ISharedRegionModule, IGridService |
52 | { | 52 | { |
53 | private static readonly ILog m_log = | 53 | private static readonly ILog m_log = |
54 | LogManager.GetLogger( | 54 | LogManager.GetLogger( |
@@ -61,8 +61,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
61 | private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>(); | 61 | private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>(); |
62 | 62 | ||
63 | private IGridService m_GridServiceConnector; | 63 | private IGridService m_GridServiceConnector; |
64 | private IHypergridService m_HypergridService; | ||
65 | |||
66 | 64 | ||
67 | #region ISharedRegionModule | 65 | #region ISharedRegionModule |
68 | 66 | ||
@@ -119,16 +117,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
119 | Object[] args = new Object[] { source }; | 117 | Object[] args = new Object[] { source }; |
120 | m_GridServiceConnector = ServerUtils.LoadPlugin<IGridService>(module, args); | 118 | m_GridServiceConnector = ServerUtils.LoadPlugin<IGridService>(module, args); |
121 | 119 | ||
122 | string hypergrid = gridConfig.GetString("HypergridService", string.Empty); | ||
123 | if (hypergrid == String.Empty) | ||
124 | { | ||
125 | m_log.Error("[HGGRID CONNECTOR]: No HypergridService named in section GridService"); | ||
126 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
127 | } | ||
128 | m_HypergridService = ServerUtils.LoadPlugin<IHypergridService>(hypergrid, args); | ||
129 | |||
130 | if (m_GridServiceConnector == null || m_HypergridService == null) | ||
131 | throw new Exception("Unable to proceed. HGGrid services could not be loaded."); | ||
132 | } | 120 | } |
133 | 121 | ||
134 | public void PostInitialise() | 122 | public void PostInitialise() |
@@ -148,7 +136,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
148 | 136 | ||
149 | m_LocalScenes[scene.RegionInfo.RegionHandle] = scene; | 137 | m_LocalScenes[scene.RegionInfo.RegionHandle] = scene; |
150 | scene.RegisterModuleInterface<IGridService>(this); | 138 | scene.RegisterModuleInterface<IGridService>(this); |
151 | scene.RegisterModuleInterface<IHypergridService>(this); | ||
152 | 139 | ||
153 | ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene); | 140 | ((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene); |
154 | 141 | ||
@@ -160,7 +147,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
160 | { | 147 | { |
161 | m_LocalScenes.Remove(scene.RegionInfo.RegionHandle); | 148 | m_LocalScenes.Remove(scene.RegionInfo.RegionHandle); |
162 | scene.UnregisterModuleInterface<IGridService>(this); | 149 | scene.UnregisterModuleInterface<IGridService>(this); |
163 | scene.UnregisterModuleInterface<IHypergridService>(this); | ||
164 | ((ISharedRegionModule)m_GridServiceConnector).RemoveRegion(scene); | 150 | ((ISharedRegionModule)m_GridServiceConnector).RemoveRegion(scene); |
165 | } | 151 | } |
166 | } | 152 | } |
@@ -201,13 +187,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
201 | 187 | ||
202 | public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) | 188 | public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) |
203 | { | 189 | { |
204 | GridRegion region = m_GridServiceConnector.GetRegionByUUID(scopeID, regionID); | 190 | return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID); |
205 | if (region != null) | 191 | //if (region != null) |
206 | return region; | 192 | // return region; |
207 | 193 | ||
208 | region = m_HypergridService.GetRegionByUUID(regionID); | 194 | //region = m_HypergridService.GetRegionByUUID(regionID); |
209 | 195 | ||
210 | return region; | 196 | //return region; |
211 | } | 197 | } |
212 | 198 | ||
213 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 199 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
@@ -216,10 +202,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
216 | int snapY = (int) (y / Constants.RegionSize) * (int)Constants.RegionSize; | 202 | int snapY = (int) (y / Constants.RegionSize) * (int)Constants.RegionSize; |
217 | 203 | ||
218 | GridRegion region = m_GridServiceConnector.GetRegionByPosition(scopeID, x, y); | 204 | GridRegion region = m_GridServiceConnector.GetRegionByPosition(scopeID, x, y); |
219 | if (region != null) | 205 | //if (region != null) |
220 | return region; | 206 | // return region; |
221 | 207 | ||
222 | region = m_HypergridService.GetRegionByPosition(snapX, snapY); | 208 | //region = m_HypergridService.GetRegionByPosition(snapX, snapY); |
223 | 209 | ||
224 | return region; | 210 | return region; |
225 | } | 211 | } |
@@ -231,7 +217,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
231 | if (region != null) | 217 | if (region != null) |
232 | return region; | 218 | return region; |
233 | 219 | ||
234 | region = m_HypergridService.GetRegionByName(regionName); | 220 | //region = m_HypergridService.GetRegionByName(regionName); |
235 | 221 | ||
236 | return region; | 222 | return region; |
237 | } | 223 | } |
@@ -241,27 +227,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
241 | if (name == string.Empty) | 227 | if (name == string.Empty) |
242 | return new List<GridRegion>(); | 228 | return new List<GridRegion>(); |
243 | 229 | ||
244 | List<GridRegion> rinfos = m_GridServiceConnector.GetRegionsByName(scopeID, name, maxNumber); | 230 | return m_GridServiceConnector.GetRegionsByName(scopeID, name, maxNumber); |
245 | |||
246 | rinfos.AddRange(m_HypergridService.GetRegionsByName(name)); | ||
247 | if (rinfos.Count > maxNumber) | ||
248 | rinfos.RemoveRange(maxNumber - 1, rinfos.Count - maxNumber); | ||
249 | |||
250 | return rinfos; | ||
251 | } | 231 | } |
252 | 232 | ||
253 | public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) | 233 | public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) |
254 | { | 234 | { |
255 | int snapXmin = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize; | 235 | return m_GridServiceConnector.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); |
256 | int snapXmax = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize; | ||
257 | int snapYmin = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize; | ||
258 | int snapYmax = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize; | ||
259 | |||
260 | List<GridRegion> rinfos = m_GridServiceConnector.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); | ||
261 | |||
262 | rinfos.AddRange(m_HypergridService.GetRegionRange(snapXmin, snapXmax, snapYmin, snapYmax)); | ||
263 | |||
264 | return rinfos; | ||
265 | } | 236 | } |
266 | 237 | ||
267 | public List<GridRegion> GetDefaultRegions(UUID scopeID) | 238 | public List<GridRegion> GetDefaultRegions(UUID scopeID) |
@@ -281,27 +252,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
281 | 252 | ||
282 | #endregion | 253 | #endregion |
283 | 254 | ||
284 | #region IHypergridService | ||
285 | |||
286 | public bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason) | ||
287 | { | ||
288 | return m_HypergridService.LinkRegion(regionDescriptor, out regionID, out regionHandle, out imageURL, out reason); | ||
289 | } | ||
290 | |||
291 | public GridRegion GetHyperlinkRegion(GridRegion gateway, UUID regionID) | ||
292 | { | ||
293 | if (m_LocalScenes.ContainsKey(gateway.RegionHandle)) | ||
294 | return gateway; | ||
295 | |||
296 | return m_HypergridService.GetHyperlinkRegion(gateway, regionID); | ||
297 | } | ||
298 | |||
299 | public GridRegion GetRegionByUUID(UUID regionID) { return null; } | ||
300 | public GridRegion GetRegionByPosition(int x, int y) { return null; } | ||
301 | public GridRegion GetRegionByName(string name) { return null; } | ||
302 | public List<GridRegion> GetRegionsByName(string name) { return null; } | ||
303 | public List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax) { return null; } | ||
304 | 255 | ||
305 | #endregion | ||
306 | } | 256 | } |
307 | } | 257 | } |