diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | 86 |
1 files changed, 37 insertions, 49 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 | ||