summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 2beca56..6e61c3e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -20,6 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
+#include <glib-unix.h>
+
#include "lib.h"
#include "encode.h"
@@ -701,6 +703,13 @@ GET:
}
}
+gboolean
+exit_on_signal_cb (SoupServer *server)
+{
+ soup_server_quit (server);
+ return G_SOURCE_REMOVE;
+}
+
int
main (int argc,
char *argv[])
@@ -740,6 +749,7 @@ main (int argc,
G_CALLBACK (request_finished_cb), ctx_table);
g_signal_connect (server, "request-aborted",
G_CALLBACK (request_aborted_cb), ctx_table);
+ g_unix_signal_add (SIGINT, (GSourceFunc)exit_on_signal_cb, server);
soup_server_run (server);
return 0;