aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs74
1 files changed, 24 insertions, 50 deletions
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}