mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 10:12:15 +01:00
r12051@catbus: nickm | 2007-03-03 16:15:52 -0500
nt_service_is_stopping should not load the NT service library calls: if they are not loaded, we cannot possibly be a service trying to shut own. Bug found by "norvid" on or-talk. Also, rename function to something slightly less error-prone. svn:r9720
This commit is contained in:
parent
bd9289cf2b
commit
25508347ec
@ -1,3 +1,9 @@
|
||||
Changes in version 0.1.2.10-rc - 2007-03-??
|
||||
o Major bugfixes (Windows)
|
||||
- Do not load the NT services library functions (which may not exist)
|
||||
just to detect if we're a service trying to shut down.
|
||||
|
||||
|
||||
Changes in version 0.1.2.9-rc - 2007-03-02
|
||||
o Major bugfixes (Windows):
|
||||
- On MinGW, use "%I64u" to printf/scanf 64-bit integers, instead
|
||||
|
1
doc/TODO
1
doc/TODO
@ -128,6 +128,7 @@ Things we'd like to do in 0.2.0.x:
|
||||
minutes" in the thrashy case, and more often than "once a week" in the
|
||||
extra-stable case.
|
||||
- Implement TLS shutdown properly when possible.
|
||||
- Maybe move NT services into their own module.
|
||||
- Features:
|
||||
- Implement a DNS proxy
|
||||
- Bridges.
|
||||
|
@ -98,10 +98,10 @@ SERVICE_STATUS_HANDLE hStatus;
|
||||
* is a job for arguments, not globals. */
|
||||
static char **backup_argv;
|
||||
static int backup_argc;
|
||||
static int nt_service_is_stopped(void);
|
||||
static int nt_service_is_stopping(void);
|
||||
static char* nt_strerror(uint32_t errnum);
|
||||
#else
|
||||
#define nt_service_is_stopped() (0)
|
||||
#define nt_service_is_stopping() (0)
|
||||
#endif
|
||||
|
||||
/** If our router descriptor ever goes this long without being regenerated
|
||||
@ -1252,7 +1252,7 @@ do_main_loop(void)
|
||||
second_elapsed_callback(0,0,NULL);
|
||||
|
||||
for (;;) {
|
||||
if (nt_service_is_stopped())
|
||||
if (nt_service_is_stopping())
|
||||
return 0;
|
||||
|
||||
#ifndef MS_WINDOWS
|
||||
@ -1884,14 +1884,18 @@ nt_service_loadlibrary(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/** If we're compiled to run as an NT service, and the service has been
|
||||
/** If we're compiled to run as an NT service, and the service wants to
|
||||
* shut down, then change our current status and return 1. Else
|
||||
* return 0.
|
||||
*/
|
||||
static int
|
||||
nt_service_is_stopped(void)
|
||||
nt_service_is_stopping(void)
|
||||
/* XXXX this function would probably _love_ to be inline, in 0.2.0. */
|
||||
{
|
||||
nt_service_loadlibrary();
|
||||
/* If we haven't loaded the function pointers, we can't possibly be an NT
|
||||
* service trying to shut down. */
|
||||
if (!service_fns.loaded)
|
||||
return 0;
|
||||
|
||||
if (service_status.dwCurrentState == SERVICE_STOP_PENDING) {
|
||||
service_status.dwWin32ExitCode = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user