aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut
diff options
context:
space:
mode:
authorDiva Canto2014-06-06 11:04:53 -0700
committerJustin Clark-Casey2014-06-10 20:28:47 +0100
commitffe07527fcd95c1bd8a8d29432fe33e350354538 (patch)
tree614ff2e79275c3aef16bd55be8345e68eb4e6ebd /OpenSim/Region/CoreModules/ServiceConnectorsOut
parentBetter comment regarding SizeX and SizeY (diff)
downloadopensim-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')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs26
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs6
2 files changed, 26 insertions, 6 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 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 0444e49..6ecc327 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
207 return m_remoteConnector.UpdateAgent(destination, cAgentData); 207 return m_remoteConnector.UpdateAgent(destination, cAgentData);
208 } 208 }
209 209
210 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) 210 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason)
211 { 211 {
212 reason = "Communications failure"; 212 reason = "Communications failure";
213 version = "Unknown"; 213 version = "Unknown";
@@ -216,12 +216,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
216 return false; 216 return false;
217 217
218 // Try local first 218 // Try local first
219 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason)) 219 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason))
220 return true; 220 return true;
221 221
222 // else do the remote thing 222 // else do the remote thing
223 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 223 if (!m_localBackend.IsLocalRegion(destination.RegionID))
224 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason); 224 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason);
225 225
226 return false; 226 return false;
227 } 227 }