From 8388fe0669f9d140028d1925284491b21a09a1bf Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 8 Sep 2008 14:30:35 +0000 Subject: * some if inversions and added {}'s for readability --- .../RemoteController/RemoteAdminPlugin.cs | 12 +++-- OpenSim/Region/Application/Application.cs | 2 + OpenSim/Region/Application/OpenSim.cs | 8 +-- OpenSim/Region/Application/OpenSimBase.cs | 36 ++++++++++--- .../Region/ClientStack/RegionApplicationBase.cs | 25 ++++----- ThirdParty/3Di/LoadBalancer/TcpServer.cs | 8 +-- ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs | 60 +++++++++++----------- 7 files changed, 91 insertions(+), 60 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 7803d92..9451f00 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -71,8 +71,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController m_configSource = openSim.ConfigSource.Source; try { - if (m_configSource.Configs["RemoteAdmin"] != null && - m_configSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) + if (m_configSource.Configs["RemoteAdmin"] == null || + !m_configSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) + { + // No config or disabled + } + else { m_config = m_configSource.Configs["RemoteAdmin"]; m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); @@ -110,8 +114,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController checkStringParameters(request, new string[] { "password", "regionID" }); if (requiredPassword != String.Empty && - (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) + (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) + { throw new Exception("wrong password"); + } UUID regionID = new UUID((string) requestData["regionID"]); diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 59ac161..8d2ce55 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -117,7 +117,9 @@ namespace OpenSim msg += "Exception: " + e.ExceptionObject.ToString() + "\r\n"; Exception ex = (Exception)e.ExceptionObject; if (ex.InnerException != null) + { msg += "InnerException: " + ex.InnerException.ToString() + "\r\n"; + } msg += "\r\n"; msg += "Application is terminating: " + e.IsTerminating.ToString() + "\r\n"; diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index edb29db..43c1d26 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -77,6 +77,7 @@ namespace OpenSim m_timedScript = startupConfig.GetString("timer_Script", "disabled"); } + base.ReadConfigSettings(); } @@ -96,13 +97,13 @@ namespace OpenSim base.Startup(); //Run Startup Commands - if (m_startupCommandsFile != String.Empty) + if (String.IsNullOrEmpty( m_startupCommandsFile )) { - RunCommandScript(m_startupCommandsFile); + m_log.Info("[STARTUP]: No startup command script specified. Moving on..."); } else { - m_log.Info("[STARTUP]: No startup command script specified. Moving on..."); + RunCommandScript(m_startupCommandsFile); } // Start timer script (run a script every xx seconds) @@ -365,6 +366,7 @@ namespace OpenSim { m_sceneManager.TrySetCurrentScene(".."); } + m_regionData.Remove(killScene.RegionInfo); m_sceneManager.CloseScene(killScene); } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index e2b2bbc..156d022 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -205,7 +205,10 @@ namespace OpenSim { IConfigSource DefaultConfig = new IniConfigSource(); if (DefaultConfig.Configs["Startup"] == null) + { DefaultConfig.AddConfig("Startup"); + } + IConfig config = DefaultConfig.Configs["Startup"]; if (config != null) { @@ -225,7 +228,9 @@ namespace OpenSim } if (DefaultConfig.Configs["StandAlone"] == null) + { DefaultConfig.AddConfig("StandAlone"); + } config = DefaultConfig.Configs["StandAlone"]; if (config != null) @@ -242,7 +247,10 @@ namespace OpenSim } if (DefaultConfig.Configs["Network"] == null) + { DefaultConfig.AddConfig("Network"); + } + config = DefaultConfig.Configs["Network"]; if (config != null) { @@ -262,7 +270,10 @@ namespace OpenSim } if (DefaultConfig.Configs["RemoteAdmin"] == null) + { DefaultConfig.AddConfig("RemoteAdmin"); + } + config = DefaultConfig.Configs["RemoteAdmin"]; if (config != null) { @@ -270,12 +281,16 @@ namespace OpenSim } if (DefaultConfig.Configs["Voice"] == null) + { DefaultConfig.AddConfig("Voice"); + } + config = DefaultConfig.Configs["Voice"]; if (config != null) { config.Set("enabled", "false"); } + return DefaultConfig; } @@ -741,18 +756,23 @@ namespace OpenSim return; } - if (null != inventoryFolder) + if (null == inventoryFolder) { - m_log.InfoFormat("[CONSOLE]: Found folder {0} {1} at {2}", inventoryFolder.Name, inventoryFolder.ID, invPath); - } - else if (null != inventoryItem) - { - m_log.InfoFormat("[CONSOLE]: Found item {0} {1} at {2}", inventoryItem.Name, inventoryItem.ID, invPath); + if (null == inventoryItem) + { + m_log.ErrorFormat("[CONSOLE]: Could not find inventory entry at path {0}", invPath); + return; + } + else + { + m_log.InfoFormat("[CONSOLE]: Found item {0} {1} at {2}", inventoryItem.Name, inventoryItem.ID, + invPath); + } } else { - m_log.ErrorFormat("[CONSOLE]: Could not find inventory entry at path {0}", invPath); - return; + m_log.InfoFormat("[CONSOLE]: Found folder {0} {1} at {2}", inventoryFolder.Name, inventoryFolder.ID, + invPath); } } diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index d1572fd..dfe922b 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -138,30 +138,31 @@ namespace OpenSim.Region.ClientStack // TODO: Remove this cruft once MasterAvatar is fully deprecated //Master Avatar Setup UserProfileData masterAvatar; - if (scene.RegionInfo.MasterAvatarAssignedUUID != UUID.Zero) - { - masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarAssignedUUID); - scene.RegionInfo.MasterAvatarFirstName = masterAvatar.FirstName; - scene.RegionInfo.MasterAvatarLastName = masterAvatar.SurName; - } - else + if (scene.RegionInfo.MasterAvatarAssignedUUID == UUID.Zero) { masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword); } - - if (masterAvatar != null) + else { - m_log.InfoFormat("[PARCEL]: Found master avatar {0} {1} [" + masterAvatar.ID.ToString() + "]", scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName); - scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.ID; + masterAvatar = m_commsManager.UserService.SetupMasterUser(scene.RegionInfo.MasterAvatarAssignedUUID); + scene.RegionInfo.MasterAvatarFirstName = masterAvatar.FirstName; + scene.RegionInfo.MasterAvatarLastName = masterAvatar.SurName; } - else + + if (masterAvatar == null) { m_log.Info("[PARCEL]: No master avatar found, using null."); scene.RegionInfo.MasterAvatarAssignedUUID = UUID.Zero; } + else + { + m_log.InfoFormat("[PARCEL]: Found master avatar {0} {1} [" + masterAvatar.ID.ToString() + "]", + scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName); + scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.ID; + } scene.LoadPrimsFromStorage(regionInfo.originRegionID); scene.StartTimer(); diff --git a/ThirdParty/3Di/LoadBalancer/TcpServer.cs b/ThirdParty/3Di/LoadBalancer/TcpServer.cs index fd5e9e2..376c0a5 100644 --- a/ThirdParty/3Di/LoadBalancer/TcpServer.cs +++ b/ThirdParty/3Di/LoadBalancer/TcpServer.cs @@ -159,14 +159,14 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer state.ms_ptr.Seek(0, SeekOrigin.End); // call loadbarancer function - if (PacketHandler != null) + if (PacketHandler == null) { - //MainLog.Instance.Verbose("TCPSERVER", "calling PacketHandler"); - PacketHandler(state.header, packet); + //MainLog.Instance.Verbose("TCPSERVER", "PacketHandler not found"); } else { - //MainLog.Instance.Verbose("TCPSERVER", "PacketHandler not found"); + //MainLog.Instance.Verbose("TCPSERVER", "calling PacketHandler"); + PacketHandler(state.header, packet); } int read_size = state.header.numbytes + TcpClient.internalPacketHeaderSize; diff --git a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs index e65e7e5..a1476fa 100644 --- a/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs +++ b/ThirdParty/3Di/RegionProxy/RegionProxyPlugin.cs @@ -396,36 +396,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy //m_log.ErrorFormat("[PROXY] Got message from {0} in thread {1}, size {2}", senderEP, sd.clientEP, numBytes); EndPoint client = proxy_map.GetClient(senderEP); - if (client != null) - { - try - { - client = ProxyCodec.DecodeProxyMessage(buffer, ref numBytes); - try - { - // This message comes from a region object, forward it to the its client - sd.server.SendTo(buffer, numBytes, SocketFlags.None, client); - //m_log.InfoFormat("[PROXY] Sending region message from {0} to {1}, size {2}", senderEP, client, numBytes); - } - catch (Exception e) - { - OpenPort(sd); // reopen the port just in case - m_log.ErrorFormat("[PROXY] Failed sending region message from {0} to {1}", senderEP, client); - m_log.Error("[PROXY]" + e.Message); - m_log.Error("[PROXY]" + e.StackTrace); - return; - } - } - catch (Exception e) - { - OpenPort(sd); // reopen the port just in case - m_log.ErrorFormat("[PROXY] Failed decoding region message from {0}", senderEP); - m_log.Error("[PROXY]" + e.Message); - m_log.Error("[PROXY]" + e.StackTrace); - return; - } - } - else + if (client == null) { // This message comes from a client object, forward it to the the region(s) ProxyCodec.EncodeProxyMessage(buffer, ref numBytes, senderEP); @@ -454,6 +425,35 @@ namespace OpenSim.ApplicationPlugins.RegionProxy } } } + else + { + try + { + client = ProxyCodec.DecodeProxyMessage(buffer, ref numBytes); + try + { + // This message comes from a region object, forward it to the its client + sd.server.SendTo(buffer, numBytes, SocketFlags.None, client); + //m_log.InfoFormat("[PROXY] Sending region message from {0} to {1}, size {2}", senderEP, client, numBytes); + } + catch (Exception e) + { + OpenPort(sd); // reopen the port just in case + m_log.ErrorFormat("[PROXY] Failed sending region message from {0} to {1}", senderEP, client); + m_log.Error("[PROXY]" + e.Message); + m_log.Error("[PROXY]" + e.StackTrace); + return; + } + } + catch (Exception e) + { + OpenPort(sd); // reopen the port just in case + m_log.ErrorFormat("[PROXY] Failed decoding region message from {0}", senderEP); + m_log.Error("[PROXY]" + e.Message); + m_log.Error("[PROXY]" + e.StackTrace); + return; + } + } } #region Nested type: ProxyMap -- cgit v1.1