From 9650632cd125fa6e5c804f76ecdfac9904e8581b Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Mon, 18 Aug 2008 21:14:38 +0000
Subject: * It appears that sometimes some IClientAPI reference is not being
 released, resulting in continual execution of the CheckConnectivity timer
 method * For now, just turn off this timer when we close the connection *
 Also some minor help refactoring creeps in to this revision.

---
 OpenSim/Framework/Console/ConsoleBase.cs           |  1 +
 OpenSim/Framework/Servers/BaseOpenSimServer.cs     | 30 ++++++++++++++
 OpenSim/Region/Application/OpenSim.cs              | 47 ++++++++++++++++++++++
 .../Region/ClientStack/LindenUDP/LLClientView.cs   | 14 ++++---
 4 files changed, 87 insertions(+), 5 deletions(-)

diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index 89fd77d..b9610e0 100644
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -245,6 +245,7 @@ namespace OpenSim.Framework.Console
             try
             {
                 string line = System.Console.ReadLine();
+                
                 while (line == null)
                 {
                     line = System.Console.ReadLine();
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 33081b9..abc2bc1 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -201,6 +201,8 @@ namespace OpenSim.Framework.Servers
             {
                 case "help":
                     Notice("");
+                    // TODO: help on commands not yet implemented
+                    //Notice("help [command] - display general help or specific command help.");
                     Notice("quit - equivalent to shutdown.");
 
                     Notice("set log level [level] - change the console logging level only.  For example, off or debug.");
@@ -253,6 +255,34 @@ namespace OpenSim.Framework.Servers
 
                 SetConsoleLogLevel(setParams);
             }
+        }    
+        
+        /// <summary>
+        /// Show help information
+        /// </summary>
+        /// <param name="helpArgs"></param>
+        public virtual void ShowHelp(string[] helpArgs)
+        {
+            if (helpArgs.Length == 0)
+            {
+                Notice("");
+                // TODO: not yet implemented
+                //Notice("help [command] - display general help or specific command help.  Try help help for more info.");
+                Notice("quit - equivalent to shutdown.");
+
+                Notice("set log level [level] - change the console logging level only.  For example, off or debug."); 
+                Notice("show info - show server information (e.g. startup path).");
+
+                if (m_stats != null)
+                    Notice("show stats - show statistical information for this server");
+
+                Notice("show threads - list tracked threads");
+                Notice("show uptime - show server startup time and uptime.");
+                Notice("show version - show server version.");
+                Notice("shutdown - shutdown the server.\n");
+                
+                return;
+            }
         }
 
         /// <summary>
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index cc2d993..2061ab9 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -56,6 +56,7 @@ namespace OpenSim
 
         private string m_timedScript = "disabled";
         private Timer m_scriptTimer;
+        
         /// <summary>
         /// List of Console Plugin Commands
         /// </summary>
@@ -600,6 +601,52 @@ namespace OpenSim
                     break;
             }
         }
+     
+        public override void ShowHelp(string[] helpArgs)
+        {
+            base.ShowHelp(helpArgs);
+            
+            m_console.Notice("alert - send alert to a designated user or all users.");
+            m_console.Notice("  alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
+            m_console.Notice("  alert general [Message] - send an alert to all users.");
+            m_console.Notice("backup - persist simulator objects to the database ahead of the normal schedule.");
+            m_console.Notice("clear-assets - clear the asset cache");
+            m_console.Notice("create-region <name> <regionfile.xml> - create a new region");
+            m_console.Notice("change-region <name> - select the region that single region commands operate upon.");
+            m_console.Notice("command-script [filename] - Execute command in a file.");
+            m_console.Notice("debug - debugging commands");
+            m_console.Notice("  debug packet 0..255 - print incoming/outgoing packets (0=off)");
+            m_console.Notice("  debug scene [scripting] [collision] [physics] - Enable/Disable debug stuff, each can be True/False");
+            m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim");
+            m_console.Notice("export-map [filename] - save image of world map");
+            m_console.Notice("force-update - force an update of prims in the scene");                                        
+            m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
+            m_console.Notice("remove-region [name] - remove a region");
+            m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)");
+            m_console.Notice("save-xml [filename] - save prims to XML (DEPRECATED)");
+            m_console.Notice("save-xml2 [filename] - save prims to XML using version 2 format");
+            m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format");
+            m_console.Notice("load-oar [filename] - load an OpenSimulator region archive.  This replaces everything in the current region.");
+            m_console.Notice("save-oar [filename] - Save the current region to an OpenSimulator region archive.");
+            m_console.Notice("script - manually trigger scripts? or script commands?");
+            m_console.Notice("set-time [x] - set the current scene time phase");
+            m_console.Notice("show assets - show state of asset cache.");
+            m_console.Notice("show users - show info about connected users.");
+            m_console.Notice("show modules - shows info about loaded modules.");
+            m_console.Notice("show regions - show running region information.");
+            m_console.Notice("config set section field value - set a config value");
+            m_console.Notice("config get section field - get a config value");
+            m_console.Notice("config save - save OpenSim.ini");
+            m_console.Notice("terrain help - show help for terrain commands.");    
+            
+            ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console);
+            
+            if (m_sandbox)
+            {
+                m_console.Notice("");
+                m_console.Notice("create user - adds a new user.");
+            }                                
+        }
 
         // see BaseOpenSimServer
         public override void Show(string ShowWhat)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 8f0e2d7..ef66e93 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -456,6 +456,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
         /// <param name="shutdownCircuit"></param>
         public void Close(bool shutdownCircuit)
         {
+            m_clientPingTimer.Enabled = false;
+            
             m_log.DebugFormat(
                 "[CLIENT]: Close has been called with shutdownCircuit = {0} on scene {1}",
                 shutdownCircuit, m_scene.RegionInfo.RegionName);
@@ -655,14 +657,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
                 if ((m_probesWithNoIngressPackets > 30 && !m_clientBlocked)
                     || (m_probesWithNoIngressPackets > 90 && m_clientBlocked))
                 {
+                    m_clientPingTimer.Enabled = false;
+                    
+                    m_log.WarnFormat(
+                        "[CLIENT]: Client for agent {0} {1} has stopped responding to pings.  Closing connection",
+                        Name, AgentId);
+                    
                     if (OnConnectionClosed != null)
                     {
-                        m_log.WarnFormat(
-                            "[CLIENT]: Client for agent {0} {1} has stopped responding to pings.  Closing connection",
-                            Name, AgentId);
-
                         OnConnectionClosed(this);
-                    }
+                    }                                       
                 }
                 else
                 {
-- 
cgit v1.1