aboutsummaryrefslogtreecommitdiff
path: root/statsd/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'statsd/main.cpp')
-rw-r--r--statsd/main.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/statsd/main.cpp b/statsd/main.cpp
index d20abc3..33ab0f8 100644
--- a/statsd/main.cpp
+++ b/statsd/main.cpp
@@ -7,7 +7,18 @@
#include <iostream>
+#include <csignal>
+
+boost::asio::io_service io_service{};
+
+void int_handler(int) {
+ io_service.stop();
+}
+
int main(int argc, char* argv[]) {
+
+ std::signal(SIGINT, int_handler);
+
namespace po = boost::program_options;
init_logging(boost::log::trivial::severity_level::trace, "statsd");
@@ -39,7 +50,7 @@ int main(int argc, char* argv[]) {
uint16_t port = vm["port"].as<uint16_t>();
ListenSettings lsettings{en4, if4, en6, if6, port, false, "", "", ""};
- Stats stats(lsettings);
+ Stats stats(io_service, lsettings);
stats.run();