From 55c299b7ad1e2919c54ba1d5fb61b1103fe16883 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 5 Mar 2009 00:27:28 +0000 Subject: moved sync thread creation before priv.drop to allow bind on privileged ports --- src/anytun.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/anytun.cpp b/src/anytun.cpp index da2f7f6..088b7ad 100644 --- a/src/anytun.cpp +++ b/src/anytun.cpp @@ -467,6 +467,18 @@ int main(int argc, char* argv[]) disableRouting=true; } #endif + +#ifndef ANYTUN_NOSYNC + boost::thread * syncListenerThread; + if(gOpt.getLocalSyncPort() != "") + syncListenerThread = new boost::thread(boost::bind(syncListener)); + + std::list connectThreads; + for(HostList::const_iterator it = connect_to.begin() ;it != connect_to.end(); ++it) { + connectThreads.push_back(new boost::thread(boost::bind(syncConnector, *it))); + } +#endif + #ifndef NO_DAEMON if(gOpt.getChrootDir() != "") do_chroot(gOpt.getChrootDir()); @@ -489,16 +501,6 @@ int main(int argc, char* argv[]) #if defined(WIN_SERVICE) || !defined(NO_SIGNALCONTROLLER) boost::thread receiverThread(boost::bind(receiver, &dev, src)); #endif -#ifndef ANYTUN_NOSYNC - boost::thread * syncListenerThread; - if(gOpt.getLocalSyncPort() != "") - syncListenerThread = new boost::thread(boost::bind(syncListener)); - - std::list connectThreads; - for(HostList::const_iterator it = connect_to.begin() ;it != connect_to.end(); ++it) { - connectThreads.push_back(new boost::thread(boost::bind(syncConnector, *it))); - } -#endif #if defined(WIN_SERVICE) int ret = 0; -- cgit v1.2.3