aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs79
1 files changed, 34 insertions, 45 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 8b8bb37..7a6a174 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -46,9 +46,12 @@ 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 49 /// Version of this service.
50 /// </summary> 50 /// </summary>
51 private const string m_Version = "SIMULATION/0.1"; 51 /// <remarks>
52 /// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2"
53 /// </remarks>
54 public string ServiceVersion { get; set; }
52 55
53 /// <summary> 56 /// <summary>
54 /// Map region ID to scene. 57 /// Map region ID to scene.
@@ -62,28 +65,39 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
62 65
63 #region Region Module interface 66 #region Region Module interface
64 67
65 public void Initialise(IConfigSource config) 68 public void Initialise(IConfigSource configSource)
66 { 69 {
67 IConfig moduleConfig = config.Configs["Modules"]; 70 IConfig moduleConfig = configSource.Configs["Modules"];
68 if (moduleConfig != null) 71 if (moduleConfig != null)
69 { 72 {
70 string name = moduleConfig.GetString("SimulationServices", ""); 73 string name = moduleConfig.GetString("SimulationServices", "");
71 if (name == Name) 74 if (name == Name)
72 { 75 {
73 //IConfig userConfig = config.Configs["SimulationService"]; 76 InitialiseService(configSource);
74 //if (userConfig == null)
75 //{
76 // m_log.Error("[AVATAR CONNECTOR]: SimulationService missing from OpenSim.ini");
77 // return;
78 //}
79 77
80 m_ModuleEnabled = true; 78 m_ModuleEnabled = true;
81 79
82 m_log.Info("[SIMULATION CONNECTOR]: Local simulation enabled"); 80 m_log.Info("[LOCAL SIMULATION CONNECTOR]: Local simulation enabled.");
83 } 81 }
84 } 82 }
85 } 83 }
86 84
85 public void InitialiseService(IConfigSource configSource)
86 {
87 ServiceVersion = "SIMULATION/0.2";
88 IConfig config = configSource.Configs["SimulationService"];
89 if (config != null)
90 {
91 ServiceVersion = config.GetString("ConnectorProtocolVersion", ServiceVersion);
92
93 if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2")
94 throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion));
95
96 m_log.InfoFormat(
97 "[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion);
98 }
99 }
100
87 public void PostInitialise() 101 public void PostInitialise()
88 { 102 {
89 } 103 }
@@ -160,7 +174,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
160 174
161 #endregion 175 #endregion
162 176
163 #region ISimulation 177 #region ISimulationService
164 178
165 public IScene GetScene(UUID regionId) 179 public IScene GetScene(UUID regionId)
166 { 180 {
@@ -221,7 +235,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
221// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 235// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
222// destination.RegionName, destination.RegionID); 236// destination.RegionName, destination.RegionID);
223 237
224 return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData); 238 return m_scenes[destination.RegionID].IncomingUpdateChildAgent(cAgentData);
225 } 239 }
226 240
227// m_log.DebugFormat( 241// m_log.DebugFormat(
@@ -231,7 +245,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
231 return false; 245 return false;
232 } 246 }
233 247
234 public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData) 248 public bool UpdateAgent(GridRegion destination, AgentPosition agentPosition)
235 { 249 {
236 if (destination == null) 250 if (destination == null)
237 return false; 251 return false;
@@ -243,37 +257,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
243 foreach (Scene s in m_scenes.Values) 257 foreach (Scene s in m_scenes.Values)
244 { 258 {
245// m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); 259// m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
246 s.IncomingChildAgentDataUpdate(cAgentData); 260 s.IncomingUpdateChildAgent(agentPosition);
247 } 261 }
248 262
249 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); 263 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
250 return true; 264 return true;
251 } 265 }
252 266
253 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
254 {
255 agent = null;
256
257 if (destination == null)
258 return false;
259
260 if (m_scenes.ContainsKey(destination.RegionID))
261 {
262// m_log.DebugFormat(
263// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
264// s.RegionInfo.RegionName, destination.RegionHandle);
265
266 return m_scenes[destination.RegionID].IncomingRetrieveRootAgent(id, out agent);
267 }
268
269 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
270 return false;
271 }
272
273 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) 267 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
274 { 268 {
275 reason = "Communications failure"; 269 reason = "Communications failure";
276 version = m_Version; 270 version = ServiceVersion;
277 if (destination == null) 271 if (destination == null)
278 return false; 272 return false;
279 273
@@ -306,12 +300,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
306 return false; 300 return false;
307 } 301 }
308 302
309 public bool CloseChildAgent(GridRegion destination, UUID id) 303 public bool CloseAgent(GridRegion destination, UUID id, string auth_token)
310 {
311 return CloseAgent(destination, id);
312 }
313
314 public bool CloseAgent(GridRegion destination, UUID id)
315 { 304 {
316 if (destination == null) 305 if (destination == null)
317 return false; 306 return false;
@@ -322,7 +311,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
322// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 311// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
323// s.RegionInfo.RegionName, destination.RegionHandle); 312// s.RegionInfo.RegionName, destination.RegionHandle);
324 313
325 Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id, false); }); 314 m_scenes[destination.RegionID].CloseAgent(id, false, auth_token);
326 return true; 315 return true;
327 } 316 }
328 //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); 317 //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent");
@@ -363,7 +352,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
363 return false; 352 return false;
364 } 353 }
365 354
366 #endregion /* IInterregionComms */ 355 #endregion
367 356
368 #region Misc 357 #region Misc
369 358
@@ -383,4 +372,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
383 372
384 #endregion 373 #endregion
385 } 374 }
386} 375} \ No newline at end of file