diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index e5a943b7d2..dbf92767af 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -427,6 +427,8 @@ namespace OpenSim.Framework.UserManagement if (userProfile != null) { + // This line needs to be in side the above if statement or the UserServer will crash on some logouts. + m_log.Info("[LOGOUT]: " + userProfile.username + " " + userProfile.surname + " from " + regionhandle + "(" + posx + "," + posy + "," + posz + ")"); userAgent = userProfile.currentAgent; if (userAgent != null) @@ -434,7 +436,10 @@ namespace OpenSim.Framework.UserManagement userAgent.agentOnline = false; userAgent.logoutTime = Util.UnixTimeSinceEpoch(); userAgent.sessionID = LLUUID.Zero; - userAgent.currentRegion = regionid; + if (regionid != null) + { + userAgent.currentRegion = regionid; + } userAgent.currentHandle = regionhandle; userAgent.currentPos = currentPos; @@ -446,9 +451,10 @@ namespace OpenSim.Framework.UserManagement } else { - m_log.Info("[LOGOUT]: didn't save logout position, currentAgent: " + userAgent.ToString() ); + // If currentagent is null, we can't reference it here or the UserServer crashes! + m_log.Info("[LOGOUT]: didn't save logout position: " + userid.ToString()); } - m_log.Info("[LOGOUT]: " + userProfile.username + " " + userProfile.surname + " from " + regionhandle + "(" + posx + "," + posy + "," + posz + ")" ); + } else { diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 96cb21eb55..3445050ee5 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -52,6 +52,8 @@ namespace OpenSim.Framework void Restart(int seconds); bool OtherRegionUp(RegionInfo thisRegion); + string GetSimulatorVersion(); + RegionInfo RegionInfo { get; } uint NextLocalId { get; } diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 17178250e4..d7f4c3d12a 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -87,7 +87,7 @@ namespace OpenSim.Region.ClientStack private readonly uint m_circuitCode; private int m_moneyBalance; - private readonly byte[] m_channelVersion = new byte[] { 0x00 }; // Dummy value needed by libSL + private byte[] m_channelVersion = Helpers.StringToField("OpenSimulator 0.5"); // Dummy value needed by libSL /* protected variables */ @@ -196,6 +196,8 @@ namespace OpenSim.Region.ClientStack { m_moneyBalance = 1000; + m_channelVersion = Helpers.StringToField(scene.GetSimulatorVersion()); + m_scene = scene; m_assetCache = assetCache; @@ -609,8 +611,16 @@ namespace OpenSim.Region.ClientStack { RegionHandshakePacket handshake = (RegionHandshakePacket)PacketPool.Instance.GetPacket(PacketType.RegionHandshake); + bool estatemanager = false; + LLUUID[] EstateManagers = regionInfo.EstateSettings.estateManagers; + for (int i = 0; i < EstateManagers.Length; i++) + { + if (EstateManagers[i] == AgentId) + estatemanager = true; + } + handshake.RegionInfo.BillableFactor = regionInfo.EstateSettings.billableFactor; - handshake.RegionInfo.IsEstateManager = false; + handshake.RegionInfo.IsEstateManager = estatemanager; handshake.RegionInfo.TerrainHeightRange00 = regionInfo.EstateSettings.terrainHeightRange0; handshake.RegionInfo.TerrainHeightRange01 = regionInfo.EstateSettings.terrainHeightRange1; handshake.RegionInfo.TerrainHeightRange10 = regionInfo.EstateSettings.terrainHeightRange2; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 3fafaf4343..a4f50286c7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -82,6 +82,8 @@ namespace OpenSim.Region.Environment.Scenes private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private int m_incrementsof15seconds = 0; + public string m_simulatorVersion = "OpenSimulator 0.5"; + protected ModuleLoader m_moduleLoader; protected StorageManager m_storageManager; protected AgentCircuitManager m_authenticateHandler; @@ -300,6 +302,22 @@ namespace OpenSim.Region.Environment.Scenes m_statsReporter = new SimStatsReporter(regInfo); m_statsReporter.OnSendStatsResult += SendSimStatsPackets; + 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_simulatorVersion = "OpenSimulator v0.5-SVN on " + OSString + " ChilTasks:" + m_sendTasksToChild.ToString() + " PhysPrim:" + m_physicalPrim.ToString(); } #endregion @@ -313,6 +331,11 @@ namespace OpenSim.Region.Environment.Scenes m_eventManager.OnPermissionError += SendPermissionAlert; } + public override string GetSimulatorVersion() + { + return m_simulatorVersion; + } + public override bool OtherRegionUp(RegionInfo otherRegion) { // Another region is up. diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 2e9532277a..e39fa9fc6a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -167,6 +167,11 @@ namespace OpenSim.Region.Environment.Scenes } public abstract bool OtherRegionUp(RegionInfo thisRegion); + public virtual string GetSimulatorVersion() + { + return "OpenSimulator v0.5 SVN"; + } + #endregion #region Shutdown