diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2014-07-14 18:43:28 (GMT) |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2014-07-14 18:43:28 (GMT) |
commit | 4ebd3a09a6979bc568459aea842f09d12f4ad4f2 (patch) | |
tree | 50c58a9559a4083172e25e2daab0530b518e45ca | |
parent | 2d94a4b759ec2fc6290f601b10109f6625eeab7b (diff) | |
download | soup-transcoding-proxy-4ebd3a09a6979bc568459aea842f09d12f4ad4f2.zip soup-transcoding-proxy-4ebd3a09a6979bc568459aea842f09d12f4ad4f2.tar.gz |
main: Add SIGINT handler
-rw-r--r-- | src/lib.c | 7 | ||||
-rw-r--r-- | src/main.c | 10 |
2 files changed, 14 insertions, 3 deletions
@@ -59,9 +59,10 @@ stp_on_gst_bus_message (GstBus *bus, return TRUE; } -gboolean stp_unref_gst_buffer (GstBuffer **buffer, - guint idx, - gpointer user_data) +gboolean +stp_unref_gst_buffer (GstBuffer **buffer, + guint idx, + gpointer user_data) { gst_buffer_unref (*buffer); *buffer = NULL; @@ -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; |