aboutsummaryrefslogtreecommitdiffstats
path: root/test/run_ntp_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/run_ntp_server.c')
-rw-r--r--test/run_ntp_server.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/run_ntp_server.c b/test/run_ntp_server.c
index bdee1fdcb..7268fa94c 100644
--- a/test/run_ntp_server.c
+++ b/test/run_ntp_server.c
@@ -19,6 +19,7 @@
#include "config.h"
#include "ntp_server.h"
+#include "signals.h"
#include <glib.h>
@@ -38,6 +39,14 @@
#include <arpa/inet.h>
#endif
+static bool quit = false;
+
+void
+on_quit(void)
+{
+ quit = true;
+}
+
static int bind_host(int sd, char *hostname, unsigned long ulAddr,
unsigned short *port)
{
@@ -113,6 +122,8 @@ open_udp_socket(char *hostname, unsigned short *port)
int
main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
{
+ signals_init();
+
struct ntp_server ntp;
ntp_server_init(&ntp);
@@ -123,7 +134,7 @@ main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
return EXIT_FAILURE;
}
- while (true) {
+ while (!quit) {
struct timeval tv = {
.tv_sec = 1,
.tv_usec = 0,