From 4fa0cbdfbb9b8c1b60c8f23edb6301962afd8533 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 8 May 2008 05:35:01 +0000 Subject: * You can haz more spring cleaning. * Eventually this codebase will be clean. >_> --- OpenSim/Data/MSSQL/MSSQLManager.cs | 7 +- OpenSim/Data/MySQL/MySQLManager.cs | 10 +-- OpenSim/Framework/ClientManager.cs | 3 +- .../Framework/Communications/Cache/AssetCache.cs | 74 ++++------------------ .../Region/ClientStack/LindenUDP/LLClientView.cs | 1 + .../Region/Environment/Scenes/SimStatsReporter.cs | 5 -- .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 23 ++----- .../Common/ScriptEngineBase/MaintenanceThread.cs | 2 +- .../Common/ScriptEngineBase/ScriptManager.cs | 4 +- 9 files changed, 26 insertions(+), 103 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs index 6d73c64..2aea641 100644 --- a/OpenSim/Data/MSSQL/MSSQLManager.cs +++ b/OpenSim/Data/MSSQL/MSSQLManager.cs @@ -264,12 +264,7 @@ namespace OpenSim.Data.MSSQL regionprofile.regionUserURI = (string)reader["regionUserURI"]; regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; - try - { - regionprofile.owner_uuid = new LLUUID((string)reader["owner_uuid"]); - } - catch(Exception) - {} + regionprofile.owner_uuid = new LLUUID((string) reader["owner_uuid"]); // World Map Addition string tempRegionMap = reader["regionMapTexture"].ToString(); if (tempRegionMap != String.Empty) diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index c62cfa7..1f95aad 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs @@ -253,13 +253,7 @@ namespace OpenSim.Data.MySQL lock (dbcon) { // Close the DB connection - try - { - dbcon.Close(); - } - catch - { - } + dbcon.Close(); // Try to reopen it try @@ -269,7 +263,7 @@ namespace OpenSim.Data.MySQL } catch (Exception e) { - m_log.Error("Unable to reconnect to database " + e.ToString()); + m_log.Error("Unable to reconnect to database " + e); } // Run the query again diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs index 4f21ab6..272cf2b 100644 --- a/OpenSim/Framework/ClientManager.cs +++ b/OpenSim/Framework/ClientManager.cs @@ -188,8 +188,7 @@ namespace OpenSim.Framework } packet.Effect = effectBlock.ToArray(); - // Wasteful, I know - IClientAPI[] LocalClients = new IClientAPI[0]; + IClientAPI[] LocalClients; lock (m_clients) { LocalClients = new IClientAPI[m_clients.Count]; diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 69e0437..fddf01d 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -334,18 +334,9 @@ namespace OpenSim.Framework.Communications.Cache /// public void AddAsset(AssetBase asset) { - string temporary = asset.Temporary ? "temporary" : String.Empty; - string type = asset.Type == 0 ? "texture" : "asset"; - - string result = "Ignored"; - if (asset.Type == 0) { - if (Textures.ContainsKey(asset.FullID)) - { - result = "Duplicate ignored."; - } - else + if (!Textures.ContainsKey(asset.FullID)) { TextureImage textur = new TextureImage(asset); Textures.Add(textur.FullID, textur); @@ -353,24 +344,15 @@ namespace OpenSim.Framework.Communications.Cache if (StatsManager.SimExtraStats != null) StatsManager.SimExtraStats.AddTexture(textur); - if (asset.Temporary) - { - result = "Added to cache"; - } - else + if (!asset.Temporary) { m_assetServer.StoreAndCommitAsset(asset); - result = "Added to server"; } } } else { - if (Assets.ContainsKey(asset.FullID)) - { - result = "Duplicate ignored."; - } - else + if (!Assets.ContainsKey(asset.FullID)) { AssetInfo assetInf = new AssetInfo(asset); Assets.Add(assetInf.FullID, assetInf); @@ -378,29 +360,17 @@ namespace OpenSim.Framework.Communications.Cache if (StatsManager.SimExtraStats != null) StatsManager.SimExtraStats.AddAsset(assetInf); - if (asset.Temporary) - { - result = "Added to cache"; - } - else + if (!asset.Temporary) { m_assetServer.StoreAndCommitAsset(asset); - result = "Added to server"; } } } -#if DEBUG - //m_log.DebugFormat("[ASSET CACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result); -#endif } // See IAssetReceiver public void AssetReceived(AssetBase asset, bool IsTexture) { -#if DEBUG - //m_log.DebugFormat("[ASSET CACHE]: Received {0} [{1}]", IsTexture ? "texture" : "asset", asset.FullID); -#endif - if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server { //check if it is a texture or not @@ -411,13 +381,7 @@ namespace OpenSim.Framework.Communications.Cache if (IsTexture) { TextureImage image = new TextureImage(asset); - if (Textures.ContainsKey(image.FullID)) - { -#if DEBUG - //m_log.DebugFormat("[ASSET CACHE]: There's already an texture {0} in memory. Skipping.", asset.FullID); -#endif - } - else + if (!Textures.ContainsKey(image.FullID)) { Textures.Add(image.FullID, image); @@ -430,13 +394,7 @@ namespace OpenSim.Framework.Communications.Cache else { AssetInfo assetInf = new AssetInfo(asset); - if (Assets.ContainsKey(assetInf.FullID)) - { -#if DEBUG - //m_log.DebugFormat("[ASSET CACHE]: There's already an asset {0} in memory. Skipping.", asset.FullID); -#endif - } - else + if (!Assets.ContainsKey(assetInf.FullID)) { Assets.Add(assetInf.FullID, assetInf); @@ -446,18 +404,14 @@ namespace OpenSim.Framework.Communications.Cache } if (RequestedAssets.ContainsKey(assetInf.FullID)) - { - #if DEBUG - //m_log.DebugFormat("[ASSET CACHE]: Moving {0} from RequestedAssets to AssetRequests", asset.FullID); - #endif - - AssetRequest req = RequestedAssets[assetInf.FullID]; - req.AssetInf = assetInf; - req.NumPackets = CalculateNumPackets(assetInf.Data); - - RequestedAssets.Remove(assetInf.FullID); - AssetRequests.Add(req); - } + { + AssetRequest req = RequestedAssets[assetInf.FullID]; + req.AssetInf = assetInf; + req.NumPackets = CalculateNumPackets(assetInf.Data); + + RequestedAssets.Remove(assetInf.FullID); + AssetRequests.Add(req); + } } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0ea7e0a..aa27fdd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3279,6 +3279,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_needAck.Add(Pack.Header.Sequence, Pack); m_unAckedBytes += Pack.ToBytes().Length; } + //BUG: severity=major - This looks like a framework bug!? catch (Exception) // HACKY { // Ignore diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index a53bfcd..a150164 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs @@ -64,11 +64,6 @@ namespace OpenSim.Region.Environment.Scenes PendingDownloads = 19, PendingUploads = 20, UnAckedBytes = 24, - - // Havok4 related... May or may not be in upcoming LLclients - // (kelly added them sometime late in January 2008) - NumRCCSLODReduced = 25, - NumRCCSFixed = 26 } // Sending a stats update every 3 seconds diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 1f23d00..74494d9 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -531,13 +531,8 @@ namespace OpenSim.Region.ScriptEngine.Common { m_host.AddScriptLPS(1); LLUUID keyID = LLUUID.Zero; - try - { - if (id.Length > 0) keyID = new LLUUID(id); - } - catch - { - } + LLUUID.TryParse(id, out keyID); + m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SenseOnce(m_localID, m_itemID, name, keyID, type, range, arc, m_host); return; @@ -547,13 +542,7 @@ namespace OpenSim.Region.ScriptEngine.Common { m_host.AddScriptLPS(1); LLUUID keyID = LLUUID.Zero; - try - { - if (id.Length > 0) keyID = new LLUUID(id); - } - catch - { - } + LLUUID.TryParse(id, out keyID); m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); return; @@ -2252,8 +2241,6 @@ namespace OpenSim.Region.ScriptEngine.Common m_host.AddScriptLPS(1); - bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state - if (m_host.ParentGroup.RootPart.m_IsAttachment && agent == m_host.ParentGroup.RootPart.m_attachedAvatar) { // When attached, certain permissions are implicit if requested from owner @@ -3181,7 +3168,7 @@ namespace OpenSim.Region.ScriptEngine.Common { return Convert.ToInt32(src.Data[index]); } - catch (FormatException e) + catch (FormatException) { return 0; } @@ -3216,7 +3203,7 @@ namespace OpenSim.Region.ScriptEngine.Common { return Convert.ToDouble(src.Data[index]); } - catch (FormatException e) + catch (FormatException) { return 0.0; } diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs index 3e9fc65..3320ddb 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs @@ -218,7 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase //} } } - catch(ThreadAbortException ex) + catch(ThreadAbortException) { m_log.Error("Thread aborted in MaintenanceLoopThread. If this is during shutdown, please ignore"); } diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 9d1cd6c..da30535 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs @@ -335,10 +335,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase ExecutorBase.scriptEvents evflags = Script.Exec.GetStateEventFlags(); return (int)evflags; } - catch (Exception e) + catch (Exception) { - // Console.WriteLine("Failed to get script reference for <" + localID + "," + itemID + ">"); - // Console.WriteLine(e.ToString()); } return 0; -- cgit v1.1