aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs86
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs74
2 files changed, 61 insertions, 99 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 3c18074..cc8203e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -46,11 +46,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 /// <summary> 48 /// <summary>
49 /// Version of this service
50 /// </summary>
51 private const string m_Version = "SIMULATION/0.1";
52
53 /// <summary>
54 /// Map region ID to scene. 49 /// Map region ID to scene.
55 /// </summary> 50 /// </summary>
56 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); 51 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
@@ -62,28 +57,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
62 57
63 #region Region Module interface 58 #region Region Module interface
64 59
65 public void Initialise(IConfigSource config) 60 public void Initialise(IConfigSource configSource)
66 { 61 {
67 IConfig moduleConfig = config.Configs["Modules"]; 62 IConfig moduleConfig = configSource.Configs["Modules"];
68 if (moduleConfig != null) 63 if (moduleConfig != null)
69 { 64 {
70 string name = moduleConfig.GetString("SimulationServices", ""); 65 string name = moduleConfig.GetString("SimulationServices", "");
71 if (name == Name) 66 if (name == Name)
72 { 67 {
73 //IConfig userConfig = config.Configs["SimulationService"]; 68 InitialiseService(configSource);
74 //if (userConfig == null)
75 //{
76 // m_log.Error("[AVATAR CONNECTOR]: SimulationService missing from OpenSim.ini");
77 // return;
78 //}
79 69
80 m_ModuleEnabled = true; 70 m_ModuleEnabled = true;
81 71
82 m_log.Info("[SIMULATION CONNECTOR]: Local simulation enabled"); 72 m_log.Info("[LOCAL SIMULATION CONNECTOR]: Local simulation enabled.");
83 } 73 }
84 } 74 }
85 } 75 }
86 76
77 public void InitialiseService(IConfigSource configSource)
78 {
79 }
80
87 public void PostInitialise() 81 public void PostInitialise()
88 { 82 {
89 } 83 }
@@ -160,7 +154,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
160 154
161 #endregion 155 #endregion
162 156
163 #region ISimulation 157 #region ISimulationService
164 158
165 public IScene GetScene(UUID regionId) 159 public IScene GetScene(UUID regionId)
166 { 160 {
@@ -191,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
191 * Agent-related communications 185 * Agent-related communications
192 */ 186 */
193 187
194 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) 188 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
195 { 189 {
196 if (destination == null) 190 if (destination == null)
197 { 191 {
@@ -203,7 +197,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
203 if (m_scenes.ContainsKey(destination.RegionID)) 197 if (m_scenes.ContainsKey(destination.RegionID))
204 { 198 {
205// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); 199// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
206 return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, out reason); 200 return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, source, out reason);
207 } 201 }
208 202
209 reason = "Did not find region " + destination.RegionName; 203 reason = "Did not find region " + destination.RegionName;
@@ -219,16 +213,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
219 { 213 {
220// m_log.DebugFormat( 214// m_log.DebugFormat(
221// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 215// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
222// s.RegionInfo.RegionName, destination.RegionHandle); 216// destination.RegionName, destination.RegionID);
223 217
224 return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData); 218 return m_scenes[destination.RegionID].IncomingUpdateChildAgent(cAgentData);
225 } 219 }
226 220
227// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); 221// m_log.DebugFormat(
222// "[LOCAL COMMS]: Did not find region {0} {1} for ChildAgentUpdate",
223// destination.RegionName, destination.RegionID);
224
228 return false; 225 return false;
229 } 226 }
230 227
231 public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData) 228 public bool UpdateAgent(GridRegion destination, AgentPosition agentPosition)
232 { 229 {
233 if (destination == null) 230 if (destination == null)
234 return false; 231 return false;
@@ -239,38 +236,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
239 // note that we really don't need the GridRegion for this call 236 // note that we really don't need the GridRegion for this call
240 foreach (Scene s in m_scenes.Values) 237 foreach (Scene s in m_scenes.Values)
241 { 238 {
242 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); 239// m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
243 s.IncomingChildAgentDataUpdate(cAgentData); 240 s.IncomingUpdateChildAgent(agentPosition);
244 } 241 }
245 242
246 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); 243 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
247 return true; 244 return true;
248 } 245 }
249 246
250 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) 247 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, EntityTransferContext ctx, out string reason)
251 {
252 agent = null;
253
254 if (destination == null)
255 return false;
256
257 if (m_scenes.ContainsKey(destination.RegionID))
258 {
259// m_log.DebugFormat(
260// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
261// s.RegionInfo.RegionName, destination.RegionHandle);
262
263 return m_scenes[destination.RegionID].IncomingRetrieveRootAgent(id, out agent);
264 }
265
266 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
267 return false;
268 }
269
270 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
271 { 248 {
272 reason = "Communications failure"; 249 reason = "Communications failure";
273 version = m_Version;
274 if (destination == null) 250 if (destination == null)
275 return false; 251 return false;
276 252
@@ -279,8 +255,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
279// m_log.DebugFormat( 255// m_log.DebugFormat(
280// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 256// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
281// s.RegionInfo.RegionName, destination.RegionHandle); 257// s.RegionInfo.RegionName, destination.RegionHandle);
258 uint sizeX = m_scenes[destination.RegionID].RegionInfo.RegionSizeX;
259 uint sizeY = m_scenes[destination.RegionID].RegionInfo.RegionSizeY;
282 260
283 return m_scenes[destination.RegionID].QueryAccess(id, position, out reason); 261 // Var regions here, and the requesting simulator is in an older version.
262 // We will forbide this, because it crashes the viewers
263 if (ctx.OutboundVersion < 0.3f && (sizeX != 256 || sizeY != 256))
264 {
265 reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading.";
266 m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from older simulator was denied");
267 return false;
268
269 }
270
271 return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, features, out reason);
284 } 272 }
285 273
286 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); 274 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
@@ -303,7 +291,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
303 return false; 291 return false;
304 } 292 }
305 293
306 public bool CloseAgent(GridRegion destination, UUID id) 294 public bool CloseAgent(GridRegion destination, UUID id, string auth_token)
307 { 295 {
308 if (destination == null) 296 if (destination == null)
309 return false; 297 return false;
@@ -314,7 +302,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
314// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 302// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
315// s.RegionInfo.RegionName, destination.RegionHandle); 303// s.RegionInfo.RegionName, destination.RegionHandle);
316 304
317 Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id, false); }); 305 m_scenes[destination.RegionID].CloseAgent(id, false, auth_token);
318 return true; 306 return true;
319 } 307 }
320 308
@@ -356,7 +344,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
356 return false; 344 return false;
357 } 345 }
358 346
359 #endregion /* IInterregionComms */ 347 #endregion
360 348
361 #region Misc 349 #region Misc
362 350
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index b2a1b23..1e095ca 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using System.IO; 31using System.IO;
31using System.Net; 32using System.Net;
32using System.Reflection; 33using System.Reflection;
@@ -37,7 +38,6 @@ using Nini.Config;
37using OpenMetaverse; 38using OpenMetaverse;
38using OpenMetaverse.StructuredData; 39using OpenMetaverse.StructuredData;
39using OpenSim.Framework; 40using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
@@ -50,9 +50,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteSimulationConnectorModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteSimulationConnectorModule")]
51 public class RemoteSimulationConnectorModule : ISharedRegionModule, ISimulationService 51 public class RemoteSimulationConnectorModule : ISharedRegionModule, ISimulationService
52 { 52 {
53 private bool initialized = false;
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 54
55 private bool initialized = false;
56 protected bool m_enabled = false; 56 protected bool m_enabled = false;
57 protected Scene m_aScene; 57 protected Scene m_aScene;
58 // RemoteSimulationConnector does not care about local regions; it delegates that to the Local module 58 // RemoteSimulationConnector does not care about local regions; it delegates that to the Local module
@@ -60,31 +60,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
60 protected SimulationServiceConnector m_remoteConnector; 60 protected SimulationServiceConnector m_remoteConnector;
61 61
62 protected bool m_safemode; 62 protected bool m_safemode;
63 protected IPAddress m_thisIP;
64 63
65 #region Region Module interface 64 #region Region Module interface
66 65
67 public virtual void Initialise(IConfigSource config) 66 public virtual void Initialise(IConfigSource configSource)
68 { 67 {
69 68 IConfig moduleConfig = configSource.Configs["Modules"];
70 IConfig moduleConfig = config.Configs["Modules"];
71 if (moduleConfig != null) 69 if (moduleConfig != null)
72 { 70 {
73 string name = moduleConfig.GetString("SimulationServices", ""); 71 string name = moduleConfig.GetString("SimulationServices", "");
74 if (name == Name) 72 if (name == Name)
75 { 73 {
76 //IConfig userConfig = config.Configs["SimulationService"]; 74 m_localBackend = new LocalSimulationConnectorModule();
77 //if (userConfig == null) 75
78 //{ 76 m_localBackend.InitialiseService(configSource);
79 // m_log.Error("[AVATAR CONNECTOR]: SimulationService missing from OpenSim.ini");
80 // return;
81 //}
82 77
83 m_remoteConnector = new SimulationServiceConnector(); 78 m_remoteConnector = new SimulationServiceConnector();
84 79
85 m_enabled = true; 80 m_enabled = true;
86 81
87 m_log.Info("[SIMULATION CONNECTOR]: Remote simulation enabled"); 82 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Remote simulation enabled.");
88 } 83 }
89 } 84 }
90 } 85 }
@@ -142,16 +137,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
142 } 137 }
143 138
144 protected virtual void InitOnce(Scene scene) 139 protected virtual void InitOnce(Scene scene)
145 { 140 {
146 m_localBackend = new LocalSimulationConnectorModule();
147 m_aScene = scene; 141 m_aScene = scene;
148 //m_regionClient = new RegionToRegionClient(m_aScene, m_hyperlinkService); 142 //m_regionClient = new RegionToRegionClient(m_aScene, m_hyperlinkService);
149 m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName);
150 } 143 }
151 144
152 #endregion 145 #endregion
153 146
154 #region IInterregionComms 147 #region ISimulationService
155 148
156 public IScene GetScene(UUID regionId) 149 public IScene GetScene(UUID regionId)
157 { 150 {
@@ -167,7 +160,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
167 * Agent-related communications 160 * Agent-related communications
168 */ 161 */
169 162
170 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) 163 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
171 { 164 {
172 if (destination == null) 165 if (destination == null)
173 { 166 {
@@ -177,13 +170,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
177 } 170 }
178 171
179 // Try local first 172 // Try local first
180 if (m_localBackend.CreateAgent(destination, aCircuit, teleportFlags, out reason)) 173 if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, out reason))
181 return true; 174 return true;
182 175
183 // else do the remote thing 176 // else do the remote thing
184 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 177 if (!m_localBackend.IsLocalRegion(destination.RegionID))
185 { 178 {
186 return m_remoteConnector.CreateAgent(destination, aCircuit, teleportFlags, out reason); 179 return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, out reason);
187 } 180 }
188 return false; 181 return false;
189 } 182 }
@@ -194,7 +187,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
194 return false; 187 return false;
195 188
196 // Try local first 189 // Try local first
197 if (m_localBackend.IsLocalRegion(destination.RegionHandle)) 190 if (m_localBackend.IsLocalRegion(destination.RegionID))
198 return m_localBackend.UpdateAgent(destination, cAgentData); 191 return m_localBackend.UpdateAgent(destination, cAgentData);
199 192
200 return m_remoteConnector.UpdateAgent(destination, cAgentData); 193 return m_remoteConnector.UpdateAgent(destination, cAgentData);
@@ -206,45 +199,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
206 return false; 199 return false;
207 200
208 // Try local first 201 // Try local first
209 if (m_localBackend.IsLocalRegion(destination.RegionHandle)) 202 if (m_localBackend.IsLocalRegion(destination.RegionID))
210 return m_localBackend.UpdateAgent(destination, cAgentData); 203 return m_localBackend.UpdateAgent(destination, cAgentData);
211 204
212 return m_remoteConnector.UpdateAgent(destination, cAgentData); 205 return m_remoteConnector.UpdateAgent(destination, cAgentData);
213 } 206 }
214 207
215 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) 208 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, EntityTransferContext ctx, out string reason)
216 {
217 agent = null;
218
219 if (destination == null)
220 return false;
221
222 // Try local first
223 if (m_localBackend.RetrieveAgent(destination, id, out agent))
224 return true;
225
226 // else do the remote thing
227 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
228 return m_remoteConnector.RetrieveAgent(destination, id, out agent);
229
230 return false;
231 }
232
233 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
234 { 209 {
235 reason = "Communications failure"; 210 reason = "Communications failure";
236 version = "Unknown";
237 211
238 if (destination == null) 212 if (destination == null)
239 return false; 213 return false;
240 214
241 // Try local first 215 // Try local first
242 if (m_localBackend.QueryAccess(destination, id, position, out version, out reason)) 216 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason))
243 return true; 217 return true;
244 218
245 // else do the remote thing 219 // else do the remote thing
246 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 220 if (!m_localBackend.IsLocalRegion(destination.RegionID))
247 return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason); 221 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason);
248 222
249 return false; 223 return false;
250 } 224 }
@@ -263,18 +237,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
263 } 237 }
264 238
265 239
266 public bool CloseAgent(GridRegion destination, UUID id) 240 public bool CloseAgent(GridRegion destination, UUID id, string auth_token)
267 { 241 {
268 if (destination == null) 242 if (destination == null)
269 return false; 243 return false;
270 244
271 // Try local first 245 // Try local first
272 if (m_localBackend.CloseAgent(destination, id)) 246 if (m_localBackend.CloseAgent(destination, id, auth_token))
273 return true; 247 return true;
274 248
275 // else do the remote thing 249 // else do the remote thing
276 if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) 250 if (!m_localBackend.IsLocalRegion(destination.RegionID))
277 return m_remoteConnector.CloseAgent(destination, id); 251 return m_remoteConnector.CloseAgent(destination, id, auth_token);
278 252
279 return false; 253 return false;
280 } 254 }
@@ -296,12 +270,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
296 } 270 }
297 271
298 // else do the remote thing 272 // else do the remote thing
299 if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) 273 if (!m_localBackend.IsLocalRegion(destination.RegionID))
300 return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall); 274 return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall);
301 275
302 return false; 276 return false;
303 } 277 }
304 278
305 #endregion /* IInterregionComms */ 279 #endregion
306 } 280 }
307} 281}