From ac9a8437fa12c0ae792c2de5276e30abd41bee5f Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Thu, 25 Jan 2018 15:50:12 +0100 Subject: [PATCH] Gracefully handle signals in retroshare-android-service --- retroshare-android-service/src/service.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/retroshare-android-service/src/service.cpp b/retroshare-android-service/src/service.cpp index a2ee0867a..b95d7318a 100644 --- a/retroshare-android-service/src/service.cpp +++ b/retroshare-android-service/src/service.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #ifdef __ANDROID__ # include "util/androiddebug.h" @@ -38,6 +39,13 @@ int main(int argc, char *argv[]) #endif QCoreApplication app(argc, argv); + + signal(SIGINT, &QCoreApplication::exit); + signal(SIGTERM, &QCoreApplication::exit); +#ifdef SIGBREAK + signal(SIGBREAK, &QCoreApplication::exit); +#endif // def SIGBREAK + ApiServer api; RsControlModule ctrl_mod(argc, argv, api.getStateTokenServer(), &api, true); api.addResourceHandler(