diff options
author | Diva Canto | 2014-06-06 11:04:53 -0700 |
---|---|---|
committer | Justin Clark-Casey | 2014-06-10 20:28:47 +0100 |
commit | ffe07527fcd95c1bd8a8d29432fe33e350354538 (patch) | |
tree | 614ff2e79275c3aef16bd55be8345e68eb4e6ebd /OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |
parent | Better comment regarding SizeX and SizeY (diff) | |
download | opensim-SC_OLD-ffe07527fcd95c1bd8a8d29432fe33e350354538.zip opensim-SC_OLD-ffe07527fcd95c1bd8a8d29432fe33e350354538.tar.gz opensim-SC_OLD-ffe07527fcd95c1bd8a8d29432fe33e350354538.tar.bz2 opensim-SC_OLD-ffe07527fcd95c1bd8a8d29432fe33e350354538.tar.xz |
Added simulation version compatibility check so that agents coming from 0.7.6 to a varregion running in 0.8 and above will be denied teleport, rather than be allowed and crash the viewer.
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 926ef05..e6de0b6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
52 | /// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2" | 52 | /// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2" |
53 | /// </remarks> | 53 | /// </remarks> |
54 | public string ServiceVersion { get; set; } | 54 | public string ServiceVersion { get; set; } |
55 | private float m_VersionNumber = 0.3f; | ||
55 | 56 | ||
56 | /// <summary> | 57 | /// <summary> |
57 | /// Map region ID to scene. | 58 | /// Map region ID to scene. |
@@ -84,15 +85,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
84 | 85 | ||
85 | public void InitialiseService(IConfigSource configSource) | 86 | public void InitialiseService(IConfigSource configSource) |
86 | { | 87 | { |
87 | ServiceVersion = "SIMULATION/0.2"; | 88 | ServiceVersion = "SIMULATION/0.3"; |
88 | IConfig config = configSource.Configs["SimulationService"]; | 89 | IConfig config = configSource.Configs["SimulationService"]; |
89 | if (config != null) | 90 | if (config != null) |
90 | { | 91 | { |
91 | ServiceVersion = config.GetString("ConnectorProtocolVersion", ServiceVersion); | 92 | ServiceVersion = config.GetString("ConnectorProtocolVersion", ServiceVersion); |
92 | 93 | ||
93 | if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2") | 94 | if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2" && ServiceVersion != "SIMULATION/0.3") |
94 | throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion)); | 95 | throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion)); |
95 | 96 | ||
97 | string[] versionComponents = ServiceVersion.Split(new char[] { '/' }); | ||
98 | if (versionComponents.Length >= 2) | ||
99 | float.TryParse(versionComponents[1], out m_VersionNumber); | ||
100 | |||
96 | m_log.InfoFormat( | 101 | m_log.InfoFormat( |
97 | "[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion); | 102 | "[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion); |
98 | } | 103 | } |
@@ -264,7 +269,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
264 | return true; | 269 | return true; |
265 | } | 270 | } |
266 | 271 | ||
267 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) | 272 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason) |
268 | { | 273 | { |
269 | reason = "Communications failure"; | 274 | reason = "Communications failure"; |
270 | version = ServiceVersion; | 275 | version = ServiceVersion; |
@@ -276,6 +281,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
276 | // m_log.DebugFormat( | 281 | // m_log.DebugFormat( |
277 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | 282 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
278 | // s.RegionInfo.RegionName, destination.RegionHandle); | 283 | // s.RegionInfo.RegionName, destination.RegionHandle); |
284 | uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX; | ||
285 | |||
286 | float theirVersionNumber = 0f; | ||
287 | string[] versionComponents = theirversion.Split(new char[] { '/' }); | ||
288 | if (versionComponents.Length >= 2) | ||
289 | float.TryParse(versionComponents[1], out theirVersionNumber); | ||
290 | |||
291 | // Var regions here, and the requesting simulator is in an older version. | ||
292 | // We will forbide this, because it crashes the viewers | ||
293 | if (theirVersionNumber < 0.3f && size > 256) | ||
294 | { | ||
295 | reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading."; | ||
296 | m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber); | ||
297 | return false; | ||
298 | } | ||
279 | 299 | ||
280 | return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, out reason); | 300 | return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, out reason); |
281 | } | 301 | } |