diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-07-15 19:09:36 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-07-15 19:09:36 +0000 |
commit | 441e02d4acb34ea85d763ef60fa63679ccaa7e41 (patch) | |
tree | c117885e7fdeffcfb77485c82cdccc43af96bc94 /src | |
parent | 545c2c6c87fb10e95f5d7df1d7ca2d3f183d1fbb (diff) | |
download | tor-441e02d4acb34ea85d763ef60fa63679ccaa7e41.tar tor-441e02d4acb34ea85d763ef60fa63679ccaa7e41.tar.gz |
Merge patch from Matt Edman for bug 162 (service never stops)
svn:r4578
Diffstat (limited to 'src')
-rw-r--r-- | src/or/main.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c index 9e7dd0653..b6b3f8f6a 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1472,6 +1472,8 @@ nt_service_is_stopped(void) service_status.dwCurrentState = SERVICE_STOPPED; SetServiceStatus(hStatus, &service_status); return 1; + } else if (service_status.dwCurrentState == SERVICE_STOPPED) { + return 1; } return 0; } @@ -1480,11 +1482,16 @@ nt_service_is_stopped(void) void nt_service_control(DWORD request) { + static struct timeval exit_now; + exit_now.tv_sec = 0; + exit_now.tv_usec = 0; + switch (request) { case SERVICE_CONTROL_STOP: case SERVICE_CONTROL_SHUTDOWN: log(LOG_ERR, "Got stop/shutdown request; shutting down cleanly."); service_status.dwCurrentState = SERVICE_STOP_PENDING; + event_loopexit(&exit_now); return; } SetServiceStatus(hStatus, &service_status); |