summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/anytun.cpp14
-rw-r--r--src/options.cpp7
2 files changed, 9 insertions, 12 deletions
diff --git a/src/anytun.cpp b/src/anytun.cpp
index 6ae4217..4fa0b25 100644
--- a/src/anytun.cpp
+++ b/src/anytun.cpp
@@ -318,21 +318,15 @@ void receiver(TunDevice* dev, PacketSource* src)
}
}
-#ifndef NO_DAEMON
-void startSendRecvThreads(PrivInfo& privs, TunDevice* dev, PacketSource* src)
-#else
void startSendRecvThreads(TunDevice* dev, PacketSource* src)
-#endif
{
src->waitUntilReady();
-
boost::thread(boost::bind(sender, dev, src));
boost::thread(boost::bind(receiver, dev, src));
}
-
#ifdef WIN_SERVICE
int main(int argc, char* argv[])
{
@@ -472,13 +466,9 @@ int main(int argc, char* argv[])
connectThreads.create_thread(boost::bind(syncConnector, *it));
#endif
- // wait for packet source to finish in a seperate thread in order
- // to be still able to process signals while waiting
-#ifndef NO_DAEMON
- boost::thread(boost::bind(startSendRecvThreads, privs, &dev, src));
-#else
+ // wait for packet source to finish in a seperate thread in order
+ // to be still able to process signals while waiting
boost::thread(boost::bind(startSendRecvThreads, &dev, src));
-#endif
#if defined(WIN_SERVICE)
int ret = 0;
diff --git a/src/options.cpp b/src/options.cpp
index 6c3437e..86ef03f 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -362,6 +362,7 @@ bool Options::parse(int argc, char* argv[])
progname_ = argv[0];
argc--;
+ bool debug = false;
bool ipv4_only = false, ipv6_only = false;
std::string role = "";
for(int i=1; argc > 0; ++i)
@@ -385,6 +386,7 @@ bool Options::parse(int argc, char* argv[])
#endif
PARSE_STRING_LIST("-L","--log", log_targets_, NOTHING)
+ PARSE_BOOL_PARAM("-U","--debug", debug, NOTHING)
#if defined(ANYCTR_OPTIONS)
@@ -470,6 +472,11 @@ bool Options::parse(int argc, char* argv[])
throw syntax_error("unknown role name: " + role, -1);
}
+ if(debug) {
+ log_targets_.push_back("stdout:5");
+ daemonize_ = false;
+ }
+
if(log_targets_.empty()) {
#ifndef _MSC_VER
#if !defined(ANYCONF_OPTIONS)