From 97816f8c901bf56e3b29bdbd5f8e320de352f45f Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Tue, 11 Nov 2008 17:02:46 +0000
Subject: * Implement basic region filtering as described in
https://lists.berlios.de/pipermail/opensim-dev/2008-November/003468.html *
This is done by sending a 'major interface version' number on sim
registration. Developers must increment this every time they make a change
that would make the previous OpenSim revision failure incompatible with the
new one (non-fatal incompatibilities are fine). * This number resides in
OpenSim.Framework.Servers.VersionInfo.MajorInterfaceVersion * This allows the
grid service to stop older, incompatible regions from connecting
---
OpenSim/Framework/Servers/BaseOpenSimServer.cs | 19 ----------
OpenSim/Framework/Servers/VersionInfo.cs | 22 ++++++++++--
OpenSim/Framework/Util.cs | 27 +++++++++++++++
OpenSim/Grid/GridServer/GridManager.cs | 40 ++++++++++++++++++----
OpenSim/Grid/GridServer/GridServerBase.cs | 2 +-
.../Region/Communications/OGS1/OGS1GridServices.cs | 1 +
OpenSim/Region/Environment/Scenes/Scene.cs | 1 +
7 files changed, 83 insertions(+), 29 deletions(-)
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 36f8d2e..aa93f6e 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -428,25 +428,6 @@ namespace OpenSim.Framework.Servers
}
m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
-
- // Add operating system information if available
- string OSString = "";
-
- if (System.Environment.OSVersion.Platform != PlatformID.Unix)
- {
- OSString = System.Environment.OSVersion.ToString();
- }
- else
- {
- OSString = Util.ReadEtcIssue();
- }
-
- if (OSString.Length > 45)
- {
- OSString = OSString.Substring(0, 45);
- }
-
- m_version += " (OS " + OSString + ")";
}
}
}
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 8f84859..c6a43ec 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -27,11 +27,27 @@
namespace OpenSim
{
- ///
- /// This is the OpenSim version string. Change this if you are releasing a new OpenSim version.
- ///
public class VersionInfo
{
+ ///
+ /// This is the OpenSim version string. Change this if you are releasing a new OpenSim version.
+ ///
public readonly static string Version = "OpenSimulator Server 0.6.0"; // stay with 27 chars (used in regioninfo)
+
+ ///
+ /// This is the external interface version. It is separate from the OpenSimulator project version.
+ ///
+ /// This version number should be
+ /// increased by 1 every time a code change makes the previous OpenSimulator revision incompatible
+ /// with the new revision. This will usually be due to interregion or grid facing interface changes.
+ ///
+ /// Changes which are compatible with an older revision (e.g. older revisions experience degraded functionality
+ /// but not outright failure) do not need a version number increment.
+ ///
+ /// Having this version number allows the grid service to reject connections from regions running a version
+ /// of the code that is too old.
+ ///
+ ///
+ public readonly static int MajorInterfaceVersion = 0;
}
}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 7caa414..f72797f 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -799,6 +799,33 @@ namespace OpenSim.Framework
x += rx;
y += ry;
}
+
+ ///
+ /// Get operating system information if available. Returns only the first 45 characters of information
+ ///
+ ///
+ /// Operating system information. Returns an empty string if none was available.
+ ///
+ public static string GetOperatingSystemInformation()
+ {
+ string os = String.Empty;
+
+ if (System.Environment.OSVersion.Platform != PlatformID.Unix)
+ {
+ os = System.Environment.OSVersion.ToString();
+ }
+ else
+ {
+ os = ReadEtcIssue();
+ }
+
+ if (os.Length > 45)
+ {
+ os = os.Substring(0, 45);
+ }
+
+ return os;
+ }
///
/// Is the given string a UUID?
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 0fc2147..32b7554 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -53,6 +53,22 @@ namespace OpenSim.Grid.GridServer
private List _MessageServers = new List();
public GridConfig Config;
+
+ ///
+ /// Used to notify old regions as to which OpenSim version to upgrade to
+ ///
+ private string m_opensimVersion;
+
+ ///
+ /// Constructor
+ ///
+ ///
+ /// Used to notify old regions as to which OpenSim version to upgrade to
+ ///
+ public GridManager(string opensimVersion)
+ {
+ m_opensimVersion = opensimVersion;
+ }
///
/// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
@@ -360,7 +376,7 @@ namespace OpenSim.Grid.GridServer
if (!requestData.ContainsKey("UUID") || !UUID.TryParse((string)requestData["UUID"], out uuid))
{
- m_log.Warn("[LOGIN PRELUDE]: Region connected without a UUID, sending back error response.");
+ m_log.Debug("[LOGIN PRELUDE]: Region connected without a UUID, sending back error response.");
return ErrorResponse("No UUID passed to grid server - unable to connect you");
}
@@ -370,21 +386,33 @@ namespace OpenSim.Grid.GridServer
}
catch (FormatException e)
{
- m_log.Warn("[LOGIN PRELUDE]: Invalid login parameters, sending back error response.");
+ m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response.");
return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString());
}
+
+ m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
if (!Config.AllowRegionRegistration)
{
- m_log.InfoFormat(
+ m_log.DebugFormat(
"[LOGIN END]: Disabled region registration blocked login request from simulator: {0}",
sim.regionName);
- return ErrorResponse("The grid is currently not accepting region registrations.");
+ return ErrorResponse("This grid is currently not accepting region registrations.");
+ }
+
+ int majorInterfaceVersion = 0;
+ if (requestData.ContainsKey("major_interface_version"))
+ int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion);
+
+ if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion)
+ {
+ return ErrorResponse(
+ String.Format(
+ "Your region is the wrong version to connect to this grid. Try changing to version {0} (interface version {1})",
+ m_opensimVersion, VersionInfo.MajorInterfaceVersion));
}
- m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
-
existingSim = GetRegion(sim.regionHandle);
if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID)
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 36ea238..9652765 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Grid.GridServer
protected virtual void SetupGridManager()
{
m_log.Info("[DATA]: Connecting to Storage Server");
- m_gridManager = new GridManager();
+ m_gridManager = new GridManager(m_version);
m_gridManager.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
m_gridManager.Config = m_config;
}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index a4fa3bb..0c13120 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -130,6 +130,7 @@ namespace OpenSim.Region.Communications.OGS1
GridParams["originUUID"] = regionInfo.originRegionID.ToString();
GridParams["server_uri"] = regionInfo.ServerURI;
GridParams["region_secret"] = regionInfo.regionSecret;
+ GridParams["major_interface_version"] = VersionInfo.MajorInterfaceVersion.ToString();
if (regionInfo.MasterAvatarAssignedUUID != UUID.Zero)
GridParams["master_avatar_uuid"] = regionInfo.MasterAvatarAssignedUUID.ToString();
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 68fac59..fd4eb58 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -319,6 +319,7 @@ namespace OpenSim.Region.Environment.Scenes
m_statsReporter.SetObjectCapacity(objectCapacity);
m_simulatorVersion = simulatorVersion
+ + " (OS " + Util.GetOperatingSystemInformation() + ")"
+ " ChilTasks:" + m_seeIntoRegionFromNeighbor.ToString()
+ " PhysPrim:" + m_physicalPrim.ToString();
--
cgit v1.1