Merge lp:~ted/ubuntu-geoip/sigterm-handler into lp:ubuntu-geoip

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 31
Merged at revision: 31
Proposed branch: lp:~ted/ubuntu-geoip/sigterm-handler
Merge into: lp:ubuntu-geoip
Diff against target: 27 lines (+10/-0)
1 file modified
src/ubuntu-geoip-provider.c (+10/-0)
To merge this branch: bzr merge lp:~ted/ubuntu-geoip/sigterm-handler
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Ubuntu GeoIP Team Pending
Review via email: mp+136513@code.launchpad.net

Description of the change

Adding a sigterm handler to make it so the processes exits gracefully. This make the coverage commands work.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ubuntu-geoip-provider.c'
2--- src/ubuntu-geoip-provider.c 2012-10-15 13:51:35 +0000
3+++ src/ubuntu-geoip-provider.c 2012-11-27 20:55:27 +0000
4@@ -1021,6 +1021,14 @@
5 return;
6 }
7
8+static void
9+sigterm_graceful_exit (int signal)
10+{
11+ g_warning("SIGTERM recieved");
12+ g_main_loop_quit(mainloop);
13+ return;
14+}
15+
16 static GOptionEntry general_options[] = {
17 {"test-data", 0, 0, G_OPTION_ARG_FILENAME, &test_data, "Path to test data to use instead of getting it from the network", "XML Data File"},
18 {NULL}
19@@ -1050,6 +1058,8 @@
20
21 mainloop = g_main_loop_new(NULL, TRUE);
22
23+ signal(SIGTERM, sigterm_graceful_exit);
24+
25 g_main_loop_run(mainloop);
26
27 g_main_loop_unref(mainloop);

Subscribers

People subscribed via source and target branches

to all changes: