projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Increase the ReplayWindow default from 16 to 32.
[tinc]
/
src
/
process.c
diff --git
a/src/process.c
b/src/process.c
index
c1038bc
..
51bd902
100644
(file)
--- a/
src/process.c
+++ b/
src/process.c
@@
-34,6
+34,7
@@
#include "subnet.h"
#include "utils.h"
#include "xalloc.h"
#include "subnet.h"
#include "utils.h"
#include "xalloc.h"
+#include "version.h"
/* If zero, don't detach from the terminal. */
bool do_detach = true;
/* If zero, don't detach from the terminal. */
bool do_detach = true;
@@
-41,6
+42,7
@@
bool sigalrm = false;
extern char **g_argv;
extern bool use_logfile;
extern char **g_argv;
extern bool use_logfile;
+extern bool use_syslog;
/* Some functions the less gifted operating systems might lack... */
/* Some functions the less gifted operating systems might lack... */
@@
-108,6
+110,8
@@
static bool install_service(void) {
return true;
}
return true;
}
+io_t stop_io;
+
DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) {
switch(request) {
case SERVICE_CONTROL_INTERROGATE:
DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) {
switch(request) {
case SERVICE_CONTROL_INTERROGATE:
@@
-124,10
+128,11
@@
DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) {
return ERROR_CALL_NOT_IMPLEMENTED;
}
return ERROR_CALL_NOT_IMPLEMENTED;
}
- event_exit();
- status.dwWaitHint = 30000;
+ status.dwWaitHint = 1000;
status.dwCurrentState = SERVICE_STOP_PENDING;
SetServiceStatus(statushandle, &status);
status.dwCurrentState = SERVICE_STOP_PENDING;
SetServiceStatus(statushandle, &status);
+ if (WSASetEvent(stop_io.event) == FALSE)
+ abort();
return NO_ERROR;
}
return NO_ERROR;
}
@@
-185,6
+190,8
@@
bool init_service(void) {
Detach from current terminal
*/
bool detach(void) {
Detach from current terminal
*/
bool detach(void) {
+ logmode_t logmode;
+
#ifndef HAVE_MINGW
signal(SIGPIPE, SIG_IGN);
signal(SIGUSR1, SIG_IGN);
#ifndef HAVE_MINGW
signal(SIGPIPE, SIG_IGN);
signal(SIGUSR1, SIG_IGN);
@@
-206,12
+213,17
@@
bool detach(void) {
#endif
}
#endif
}
- openlogger(identname, use_logfile?LOGMODE_FILE:(do_detach?LOGMODE_SYSLOG:LOGMODE_STDERR));
+ if(use_logfile)
+ logmode = LOGMODE_FILE;
+ else if(use_syslog || do_detach)
+ logmode = LOGMODE_SYSLOG;
+ else
+ logmode = LOGMODE_STDERR;
+
+ openlogger(identname, logmode);
logger(DEBUG_ALWAYS, LOG_NOTICE, "tincd %s (%s %s) starting, debug level %d",
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;
}
return true;
}
-
-