File asp-state4-signals.patch of Package xsp
Index: xsp-4.7.1/tools/asp_state/Makefile.am
===================================================================
--- xsp-4.7.1.orig/tools/asp_state/Makefile.am
+++ xsp-4.7.1/tools/asp_state/Makefile.am
@@ -1,4 +1,4 @@
-MCSFLAGS= -debug+ -debug:full -nologo
+MCSFLAGS= -debug+ -debug:full -nologo -r:Mono.Posix.dll
scripts4 = asp-state4.exe
data4 = asp-state4.exe.config
Index: xsp-4.7.1/tools/asp_state/asp_state.cs
===================================================================
--- xsp-4.7.1.orig/tools/asp_state/asp_state.cs
+++ xsp-4.7.1/tools/asp_state/asp_state.cs
@@ -11,6 +11,8 @@ using System;
using System.IO;
using System.Reflection;
using System.Runtime.Remoting;
+using Mono.Unix;
+using Mono.Unix.Native;
namespace Mono.ASPNET.Tools {
@@ -64,10 +66,21 @@ and works until <Enter> is pressed.
public static void Main (string [] args)
{
if (args.Length == 0) {
+ UnixSignal [] signals = new UnixSignal[] {
+ new UnixSignal(Signum.SIGINT),
+ new UnixSignal(Signum.SIGTERM),
+ };
RemotingConfiguration.Configure (ConfigurationFileName, false);
ShowVerboseConfigurationInfo(ConfigurationFileName);
- Console.Write("Press <Enter> to stop...");
- Console.ReadLine ();
+ // Wait for a unix signal to exit
+ for (bool exit = false; !exit; )
+ {
+ int id = UnixSignal.WaitAny(signals);
+ if (id >= 0 && id < signals.Length)
+ {
+ if (signals[id].IsSet) exit = true;
+ }
+ }
} else {
ShowUsage();
}