diff options
author | Melanie Thielker | 2017-01-11 23:05:06 +0000 |
---|---|---|
committer | Melanie Thielker | 2017-01-11 23:05:06 +0000 |
commit | 14d6d6f7a5c9da0dada36a4624325fb030db799a (patch) | |
tree | 1a8a8c8ac0bb673391ca91c0d3b2eb0a1377ea08 /OpenSim | |
parent | add a bit clarification about grid private port protection (diff) | |
download | opensim-SC_OLD-14d6d6f7a5c9da0dada36a4624325fb030db799a.zip opensim-SC_OLD-14d6d6f7a5c9da0dada36a4624325fb030db799a.tar.gz opensim-SC_OLD-14d6d6f7a5c9da0dada36a4624325fb030db799a.tar.bz2 opensim-SC_OLD-14d6d6f7a5c9da0dada36a4624325fb030db799a.tar.xz |
Also add the ability to quit on SIGTERM for ROBUST
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Server/Base/ServicesServerBase.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index f60b5fb..d151de6 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -61,6 +61,9 @@ namespace OpenSim.Server.Base | |||
61 | // | 61 | // |
62 | private bool m_Running = true; | 62 | private bool m_Running = true; |
63 | 63 | ||
64 | private static Mono.Unix.UnixSignal[] signals; | ||
65 | |||
66 | |||
64 | // Handle all the automagical stuff | 67 | // Handle all the automagical stuff |
65 | // | 68 | // |
66 | public ServicesServerBase(string prompt, string[] args) : base() | 69 | public ServicesServerBase(string prompt, string[] args) : base() |
@@ -183,6 +186,39 @@ namespace OpenSim.Server.Base | |||
183 | RegisterCommonCommands(); | 186 | RegisterCommonCommands(); |
184 | RegisterCommonComponents(Config); | 187 | RegisterCommonComponents(Config); |
185 | 188 | ||
189 | Thread signal_thread = new Thread (delegate () | ||
190 | { | ||
191 | while (true) | ||
192 | { | ||
193 | // Wait for a signal to be delivered | ||
194 | int index = Mono.Unix.UnixSignal.WaitAny (signals, -1); | ||
195 | |||
196 | //Mono.Unix.Native.Signum signal = signals [index].Signum; | ||
197 | ShutdownSpecific(); | ||
198 | m_Running = false; | ||
199 | Environment.Exit(0); | ||
200 | } | ||
201 | }); | ||
202 | |||
203 | if(!Util.IsWindows()) | ||
204 | { | ||
205 | try | ||
206 | { | ||
207 | // linux mac os specifics | ||
208 | signals = new Mono.Unix.UnixSignal[] | ||
209 | { | ||
210 | new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM) | ||
211 | }; | ||
212 | signal_thread.Start(); | ||
213 | } | ||
214 | catch (Exception e) | ||
215 | { | ||
216 | m_log.Info("Could not set up UNIX signal handlers. SIGTERM will not"); | ||
217 | m_log.InfoFormat("shut down gracefully: {0}", e.Message); | ||
218 | m_log.Debug("Exception was: ", e); | ||
219 | } | ||
220 | } | ||
221 | |||
186 | // Allow derived classes to perform initialization that | 222 | // Allow derived classes to perform initialization that |
187 | // needs to be done after the console has opened | 223 | // needs to be done after the console has opened |
188 | Initialise(); | 224 | Initialise(); |