aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/Application.cs1
-rw-r--r--OpenSim/Region/Application/OpenSim.cs62
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs87
3 files changed, 30 insertions, 120 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index c3e7ec2..e451aa8 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -124,6 +124,7 @@ namespace OpenSim
124 workerThreads = workerThreadsMax; 124 workerThreads = workerThreadsMax;
125 m_log.InfoFormat("[OPENSIM MAIN]: Limiting worker threads to {0}",workerThreads); 125 m_log.InfoFormat("[OPENSIM MAIN]: Limiting worker threads to {0}",workerThreads);
126 } 126 }
127
127 // Increase the number of IOCP threads available. 128 // Increase the number of IOCP threads available.
128 // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17) 129 // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17)
129 if (iocpThreads < iocpThreadsMin) 130 if (iocpThreads < iocpThreadsMin)
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index a7e7d03..6dd1f5b 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -86,6 +86,7 @@ namespace OpenSim
86 IConfig startupConfig = Config.Configs["Startup"]; 86 IConfig startupConfig = Config.Configs["Startup"];
87 IConfig networkConfig = Config.Configs["Network"]; 87 IConfig networkConfig = Config.Configs["Network"];
88 88
89 int stpMinThreads = 2;
89 int stpMaxThreads = 15; 90 int stpMaxThreads = 15;
90 91
91 if (startupConfig != null) 92 if (startupConfig != null)
@@ -112,12 +113,13 @@ namespace OpenSim
112 if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod)) 113 if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod))
113 Util.FireAndForgetMethod = asyncCallMethod; 114 Util.FireAndForgetMethod = asyncCallMethod;
114 115
116 stpMinThreads = startupConfig.GetInt("MinPoolThreads", 15);
115 stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15); 117 stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15);
116 m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); 118 m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) ");
117 } 119 }
118 120
119 if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) 121 if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
120 Util.InitThreadPool(stpMaxThreads); 122 Util.InitThreadPool(stpMinThreads, stpMaxThreads);
121 123
122 m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); 124 m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod);
123 } 125 }
@@ -226,18 +228,6 @@ namespace OpenSim
226 "Force the update of all objects on clients", 228 "Force the update of all objects on clients",
227 HandleForceUpdate); 229 HandleForceUpdate);
228 230
229 m_console.Commands.AddCommand("Debug", false, "debug packet",
230 "debug packet <level> [<avatar-first-name> <avatar-last-name>]",
231 "Turn on packet debugging",
232 "If level > 255 then all incoming and outgoing packets are logged.\n"
233 + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
234 + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
235 + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
236 + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n"
237 + "If level <= 0 then no packets are logged.\n"
238 + "If an avatar name is given then only packets from that avatar are logged",
239 Debug);
240
241 m_console.Commands.AddCommand("General", false, "change region", 231 m_console.Commands.AddCommand("General", false, "change region",
242 "change region <region name>", 232 "change region <region name>",
243 "Change current console region", ChangeSelectedRegion); 233 "Change current console region", ChangeSelectedRegion);
@@ -372,7 +362,7 @@ namespace OpenSim
372 "Unload a module", HandleModules); 362 "Unload a module", HandleModules);
373 } 363 }
374 364
375 public override void ShutdownSpecific() 365 protected override void ShutdownSpecific()
376 { 366 {
377 if (m_shutdownCommandsFile != String.Empty) 367 if (m_shutdownCommandsFile != String.Empty)
378 { 368 {
@@ -435,8 +425,8 @@ namespace OpenSim
435 { 425 {
436 RegionInfo regionInfo = presence.Scene.RegionInfo; 426 RegionInfo regionInfo = presence.Scene.RegionInfo;
437 427
438 if (presence.Firstname.ToLower().Contains(mainParams[2].ToLower()) && 428 if (presence.Firstname.ToLower().Equals(mainParams[2].ToLower()) &&
439 presence.Lastname.ToLower().Contains(mainParams[3].ToLower())) 429 presence.Lastname.ToLower().Equals(mainParams[3].ToLower()))
440 { 430 {
441 MainConsole.Instance.Output( 431 MainConsole.Instance.Output(
442 String.Format( 432 String.Format(
@@ -450,6 +440,7 @@ namespace OpenSim
450 presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n"); 440 presence.ControllingClient.Kick("\nYou have been logged out by an administrator.\n");
451 441
452 presence.Scene.IncomingCloseAgent(presence.UUID, force); 442 presence.Scene.IncomingCloseAgent(presence.UUID, force);
443 break;
453 } 444 }
454 } 445 }
455 446
@@ -701,45 +692,6 @@ namespace OpenSim
701 RefreshPrompt(); 692 RefreshPrompt();
702 } 693 }
703 694
704 /// <summary>
705 /// Turn on some debugging values for OpenSim.
706 /// </summary>
707 /// <param name="args"></param>
708 protected void Debug(string module, string[] args)
709 {
710 if (args.Length == 1)
711 return;
712
713 switch (args[1])
714 {
715 case "packet":
716 string name = null;
717 if (args.Length == 5)
718 name = string.Format("{0} {1}", args[3], args[4]);
719
720 if (args.Length > 2)
721 {
722 int newDebug;
723 if (int.TryParse(args[2], out newDebug))
724 {
725 SceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name);
726 // We provide user information elsewhere if any clients had their debug level set.
727// MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug);
728 }
729 else
730 {
731 MainConsole.Instance.Output("Usage: debug packet 0..255");
732 }
733 }
734
735 break;
736
737 default:
738 MainConsole.Instance.Output("Unknown debug command");
739 break;
740 }
741 }
742
743 // see BaseOpenSimServer 695 // see BaseOpenSimServer
744 /// <summary> 696 /// <summary>
745 /// Many commands list objects for debugging. Some of the types are listed here 697 /// Many commands list objects for debugging. Some of the types are listed here
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 7361f50..db76529 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -246,10 +246,7 @@ namespace OpenSim
246 } 246 }
247 247
248 if (m_console != null) 248 if (m_console != null)
249 {
250 StatsManager.RegisterConsoleCommands(m_console);
251 AddPluginCommands(m_console); 249 AddPluginCommands(m_console);
252 }
253 } 250 }
254 251
255 protected virtual void AddPluginCommands(ICommandConsole console) 252 protected virtual void AddPluginCommands(ICommandConsole console)
@@ -504,9 +501,6 @@ namespace OpenSim
504 scene.SnmpService.LinkUp(scene); 501 scene.SnmpService.LinkUp(scene);
505 } 502 }
506 503
507 scene.Start();
508 scene.StartScripts();
509
510 return clientServers; 504 return clientServers;
511 } 505 }
512 506
@@ -821,7 +815,7 @@ namespace OpenSim
821 815
822 if (foundClientServer) 816 if (foundClientServer)
823 { 817 {
824 m_clientServers[clientServerElement].NetworkStop(); 818 m_clientServers[clientServerElement].Stop();
825 m_clientServers.RemoveAt(clientServerElement); 819 m_clientServers.RemoveAt(clientServerElement);
826 } 820 }
827 } 821 }
@@ -835,6 +829,7 @@ namespace OpenSim
835 ShutdownClientServer(whichRegion); 829 ShutdownClientServer(whichRegion);
836 IScene scene; 830 IScene scene;
837 CreateRegion(whichRegion, true, out scene); 831 CreateRegion(whichRegion, true, out scene);
832 scene.Start();
838 } 833 }
839 834
840 # region Setup methods 835 # region Setup methods
@@ -848,73 +843,49 @@ namespace OpenSim
848 /// <summary> 843 /// <summary>
849 /// Handler to supply the current status of this sim 844 /// Handler to supply the current status of this sim
850 /// </summary> 845 /// </summary>
846 /// <remarks>
851 /// Currently this is always OK if the simulator is still listening for connections on its HTTP service 847 /// Currently this is always OK if the simulator is still listening for connections on its HTTP service
852 public class SimStatusHandler : IStreamedRequestHandler 848 /// </remarks>
849 public class SimStatusHandler : BaseStreamHandler
853 { 850 {
854 public byte[] Handle(string path, Stream request, 851 public SimStatusHandler() : base("GET", "/simstatus", "SimStatus", "Simulator Status") {}
852
853 protected override byte[] ProcessRequest(string path, Stream request,
855 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 854 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
856 { 855 {
857 return Util.UTF8.GetBytes("OK"); 856 return Util.UTF8.GetBytes("OK");
858 } 857 }
859 858
860 public string Name { get { return "SimStatus"; } } 859 public override string ContentType
861 public string Description { get { return "Simulator Status"; } }
862
863 public string ContentType
864 { 860 {
865 get { return "text/plain"; } 861 get { return "text/plain"; }
866 } 862 }
867
868 public string HttpMethod
869 {
870 get { return "GET"; }
871 }
872
873 public string Path
874 {
875 get { return "/simstatus"; }
876 }
877 } 863 }
878 864
879 /// <summary> 865 /// <summary>
880 /// Handler to supply the current extended status of this sim 866 /// Handler to supply the current extended status of this sim
881 /// Sends the statistical data in a json serialization 867 /// Sends the statistical data in a json serialization
882 /// </summary> 868 /// </summary>
883 public class XSimStatusHandler : IStreamedRequestHandler 869 public class XSimStatusHandler : BaseStreamHandler
884 { 870 {
885 OpenSimBase m_opensim; 871 OpenSimBase m_opensim;
886 string osXStatsURI = String.Empty;
887
888 public string Name { get { return "XSimStatus"; } }
889 public string Description { get { return "Simulator XStatus"; } }
890 872
891 public XSimStatusHandler(OpenSimBase sim) 873 public XSimStatusHandler(OpenSimBase sim)
874 : base("GET", "/" + Util.SHA1Hash(sim.osSecret), "XSimStatus", "Simulator XStatus")
892 { 875 {
893 m_opensim = sim; 876 m_opensim = sim;
894 osXStatsURI = Util.SHA1Hash(sim.osSecret);
895 } 877 }
896 878
897 public byte[] Handle(string path, Stream request, 879 protected override byte[] ProcessRequest(string path, Stream request,
898 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 880 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
899 { 881 {
900 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); 882 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
901 } 883 }
902 884
903 public string ContentType 885 public override string ContentType
904 { 886 {
905 get { return "text/plain"; } 887 get { return "text/plain"; }
906 } 888 }
907
908 public string HttpMethod
909 {
910 get { return "GET"; }
911 }
912
913 public string Path
914 {
915 // This is for the OpenSimulator instance and is the osSecret hashed
916 get { return "/" + osXStatsURI; }
917 }
918 } 889 }
919 890
920 /// <summary> 891 /// <summary>
@@ -923,42 +894,26 @@ namespace OpenSim
923 /// If the request contains a key, "callback" the response will be wrappend in the 894 /// If the request contains a key, "callback" the response will be wrappend in the
924 /// associated value for jsonp used with ajax/javascript 895 /// associated value for jsonp used with ajax/javascript
925 /// </summary> 896 /// </summary>
926 public class UXSimStatusHandler : IStreamedRequestHandler 897 protected class UXSimStatusHandler : BaseStreamHandler
927 { 898 {
928 OpenSimBase m_opensim; 899 OpenSimBase m_opensim;
929 string osUXStatsURI = String.Empty;
930
931 public string Name { get { return "UXSimStatus"; } }
932 public string Description { get { return "Simulator UXStatus"; } }
933 900
934 public UXSimStatusHandler(OpenSimBase sim) 901 public UXSimStatusHandler(OpenSimBase sim)
902 : base("GET", "/" + sim.userStatsURI, "UXSimStatus", "Simulator UXStatus")
935 { 903 {
936 m_opensim = sim; 904 m_opensim = sim;
937 osUXStatsURI = sim.userStatsURI;
938
939 } 905 }
940 906
941 public byte[] Handle(string path, Stream request, 907 protected override byte[] ProcessRequest(string path, Stream request,
942 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 908 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
943 { 909 {
944 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); 910 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
945 } 911 }
946 912
947 public string ContentType 913 public override string ContentType
948 { 914 {
949 get { return "text/plain"; } 915 get { return "text/plain"; }
950 } 916 }
951
952 public string HttpMethod
953 {
954 get { return "GET"; }
955 }
956
957 public string Path
958 {
959 // This is for the OpenSimulator instance and is the user provided URI
960 get { return "/" + osUXStatsURI; }
961 }
962 } 917 }
963 918
964 #endregion 919 #endregion
@@ -966,7 +921,7 @@ namespace OpenSim
966 /// <summary> 921 /// <summary>
967 /// Performs any last-minute sanity checking and shuts down the region server 922 /// Performs any last-minute sanity checking and shuts down the region server
968 /// </summary> 923 /// </summary>
969 public override void ShutdownSpecific() 924 protected override void ShutdownSpecific()
970 { 925 {
971 if (proxyUrl.Length > 0) 926 if (proxyUrl.Length > 0)
972 { 927 {
@@ -986,6 +941,8 @@ namespace OpenSim
986 { 941 {
987 m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e); 942 m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e);
988 } 943 }
944
945 base.ShutdownSpecific();
989 } 946 }
990 947
991 /// <summary> 948 /// <summary>