aboutsummaryrefslogtreecommitdiff
path: root/src/or/ntmain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/ntmain.c')
-rw-r--r--src/or/ntmain.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/or/ntmain.c b/src/or/ntmain.c
index ded0e0d307..d0d5276c48 100644
--- a/src/or/ntmain.c
+++ b/src/or/ntmain.c
@@ -1,12 +1,20 @@
/* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
- * Copyright (c) 2007-2016, The Tor Project, Inc. */
+ * Copyright (c) 2007-2017, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
* \file ntmain.c
*
- * \brief Entry points for running/configuring Tor as Windows Service.
+ * \brief Entry points for running/configuring Tor as a Windows Service.
+ *
+ * Windows Services expect to be registered with the operating system, and to
+ * have entry points for starting, stopping, and monitoring them. This module
+ * implements those entry points so that a tor relay or client or hidden
+ * service can run as a Windows service. Therefore, this module
+ * is only compiled when building for Windows.
+ *
+ * Warning: this module is not very well tested or very well maintained.
*/
#ifdef _WIN32
@@ -16,11 +24,7 @@
#include "main.h"
#include "ntmain.h"
-#ifdef HAVE_EVENT2_EVENT_H
#include <event2/event.h>
-#else
-#include <event.h>
-#endif
#include <windows.h>
#define GENSRV_SERVICENAME "tor"
@@ -289,6 +293,7 @@ nt_service_body(int argc, char **argv)
* event loop */
service_status.dwCurrentState = SERVICE_RUNNING;
service_fns.SetServiceStatus_fn(hStatus, &service_status);
+ set_main_thread();
do_main_loop();
tor_cleanup();
}