X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprocess.c;h=2243bf9c46c46b569d404f4af2b79e73f4bc69a5;hb=afb175873e6aa10d2d4dca3572edf054968c538d;hp=98f4d33a811d0e9c3d6edd8d1a2a3d3413a7d29b;hpb=ffbc99558cae4dff876645fe205349d8c4cd7acb;p=tinc diff --git a/src/process.c b/src/process.c index 98f4d33a..2243bf9c 100644 --- a/src/process.c +++ b/src/process.c @@ -34,6 +34,7 @@ #include "subnet.h" #include "utils.h" #include "xalloc.h" +#include "version.h" /* If zero, don't detach from the terminal. */ bool do_detach = true; @@ -108,7 +109,7 @@ static bool install_service(void) { return true; } -static io_t stop_io; +io_t stop_io; DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) { switch(request) { @@ -134,17 +135,9 @@ DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) { return NO_ERROR; } -static void stop_handler(void *data, int flags) { - event_exit(); -} - VOID WINAPI run_service(DWORD argc, LPTSTR* argv) { extern int main2(int argc, char **argv); - io_add_event(&stop_io, stop_handler, NULL, WSACreateEvent()); - if (stop_io.event == FALSE) - abort(); - status.dwServiceType = SERVICE_WIN32; status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; status.dwWin32ExitCode = 0; @@ -171,9 +164,6 @@ VOID WINAPI run_service(DWORD argc, LPTSTR* argv) { SetServiceStatus(statushandle, &status); } - if (WSACloseEvent(stop_io.event) == FALSE) - abort(); - io_del(&stop_io); return; } @@ -223,7 +213,7 @@ bool detach(void) { openlogger(identname, use_logfile?LOGMODE_FILE:(do_detach?LOGMODE_SYSLOG:LOGMODE_STDERR)); logger(DEBUG_ALWAYS, LOG_NOTICE, "tincd %s (%s %s) starting, debug level %d", - VERSION, __DATE__, __TIME__, debug_level); + VERSION, BUILD_DATE, BUILD_TIME, debug_level); return true; }