aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2016-12-12 00:07:36 +0000
committerMelanie Thielker2016-12-12 00:07:36 +0000
commit4d1536f1ecde8ed03e1f2e69f45207eb9dddfa7c (patch)
treeb4b12c0154dea3da2dedaebf328673ccdf42e30d
parentIf a region address is resolveable to a single address, resolve it on (diff)
downloadopensim-SC-4d1536f1ecde8ed03e1f2e69f45207eb9dddfa7c.zip
opensim-SC-4d1536f1ecde8ed03e1f2e69f45207eb9dddfa7c.tar.gz
opensim-SC-4d1536f1ecde8ed03e1f2e69f45207eb9dddfa7c.tar.bz2
opensim-SC-4d1536f1ecde8ed03e1f2e69f45207eb9dddfa7c.tar.xz
Allow OpenSim to respond to Unix signals. This may need work to be
properly ignoed on Windows. Windows devs, please test and check for platform flags if this causes issues in Windows
-rw-r--r--OpenSim/Region/Application/OpenSim.cs25
-rwxr-xr-xbin/Mono.Posix.dllbin0 -> 207872 bytes
-rw-r--r--prebuild.xml1
3 files changed, 24 insertions, 2 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index cf2bf33..203fe5e 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Threading;
29using System.Collections; 30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Diagnostics; 32using System.Diagnostics;
@@ -74,7 +75,7 @@ namespace OpenSim
74 75
75 private string m_timedScript = "disabled"; 76 private string m_timedScript = "disabled";
76 private int m_timeInterval = 1200; 77 private int m_timeInterval = 1200;
77 private Timer m_scriptTimer; 78 private System.Timers.Timer m_scriptTimer;
78 79
79 public OpenSim(IConfigSource configSource) : base(configSource) 80 public OpenSim(IConfigSource configSource) : base(configSource)
80 { 81 {
@@ -125,6 +126,25 @@ namespace OpenSim
125 m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); 126 m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod);
126 } 127 }
127 128
129 private static Mono.Unix.UnixSignal[] signals = new Mono.Unix.UnixSignal[]
130 {
131// new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGINT),
132 new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM)
133 };
134
135 private Thread signal_thread = new Thread (delegate ()
136 {
137 System.Console.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
138 while (true)
139 {
140 // Wait for a signal to be delivered
141 int index = Mono.Unix.UnixSignal.WaitAny (signals, -1);
142
143 //Mono.Unix.Native.Signum signal = signals [index].Signum;
144 MainConsole.Instance.RunCommand("shutdown");
145 }
146 });
147
128 /// <summary> 148 /// <summary>
129 /// Performs initialisation of the scene, such as loading configuration from disk. 149 /// Performs initialisation of the scene, such as loading configuration from disk.
130 /// </summary> 150 /// </summary>
@@ -134,6 +154,7 @@ namespace OpenSim
134 m_log.Info("========================= STARTING OPENSIM ========================="); 154 m_log.Info("========================= STARTING OPENSIM =========================");
135 m_log.Info("===================================================================="); 155 m_log.Info("====================================================================");
136 156
157 signal_thread.Start();
137 //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); 158 //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
138 // http://msdn.microsoft.com/en-us/library/bb384202.aspx 159 // http://msdn.microsoft.com/en-us/library/bb384202.aspx
139 //GCSettings.LatencyMode = GCLatencyMode.Batch; 160 //GCSettings.LatencyMode = GCLatencyMode.Batch;
@@ -217,7 +238,7 @@ namespace OpenSim
217 // Start timer script (run a script every xx seconds) 238 // Start timer script (run a script every xx seconds)
218 if (m_timedScript != "disabled") 239 if (m_timedScript != "disabled")
219 { 240 {
220 m_scriptTimer = new Timer(); 241 m_scriptTimer = new System.Timers.Timer();
221 m_scriptTimer.Enabled = true; 242 m_scriptTimer.Enabled = true;
222 m_scriptTimer.Interval = m_timeInterval*1000; 243 m_scriptTimer.Interval = m_timeInterval*1000;
223 m_scriptTimer.Elapsed += RunAutoTimerScript; 244 m_scriptTimer.Elapsed += RunAutoTimerScript;
diff --git a/bin/Mono.Posix.dll b/bin/Mono.Posix.dll
new file mode 100755
index 0000000..97ec8bf
--- /dev/null
+++ b/bin/Mono.Posix.dll
Binary files differ
diff --git a/prebuild.xml b/prebuild.xml
index 2bb053e..cb39e18 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1790,6 +1790,7 @@
1790 <Reference name="System.Core"/> 1790 <Reference name="System.Core"/>
1791 <Reference name="System.Xml"/> 1791 <Reference name="System.Xml"/>
1792 <Reference name="Mono.Addins" path="../../../bin/"/> 1792 <Reference name="Mono.Addins" path="../../../bin/"/>
1793 <Reference name="Mono.Posix" path="../../../bin/"/>
1793 <Reference name="NDesk.Options" path="../../../bin/"/> 1794 <Reference name="NDesk.Options" path="../../../bin/"/>
1794 <Reference name="OpenMetaverseTypes" path="../../../bin/"/> 1795 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
1795 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> 1796 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>