X-Git-Url: https://git.syn-net.org/debian/?p=anytun.git;a=blobdiff_plain;f=src%2Fanytun-config.cpp;h=d09f1e8ce94c273fac703a123cf0e6cd51e32202;hp=f8bc4f4d7c9715c4d1916aca3d4621d835b03f47;hb=ece844834d2cecc028ce81ca283f5d441088580e;hpb=bb834fe0ed7a38b724f49b944adb801634eb6194 diff --git a/src/anytun-config.cpp b/src/anytun-config.cpp index f8bc4f4..d09f1e8 100644 --- a/src/anytun-config.cpp +++ b/src/anytun-config.cpp @@ -88,6 +88,11 @@ void createConnection(const PacketSourceEndpoint & remote_end, ConnectionList & sem.up(); } +void createConnectionResolver(PacketSourceResolverIt& it, ConnectionList & cl, u_int16_t seqSize, SyncQueue & queue, mux_t mux, Semaphore& sem) +{ + createConnection(*it, cl, seqSize, queue, mux, sem); +} + void createConnectionError(const std::exception& e, Semaphore& sem, int& ret) { cLog.msg(Log::PRIO_ERROR) << "uncaught runtime error: " << e.what(); @@ -99,20 +104,12 @@ int main(int argc, char* argv[]) { try { - bool result = gOpt.parse(argc, argv); - if(!result) { - gOpt.printUsage(); + if(!gOpt.parse(argc, argv)) exit(0); - } + StringList targets = gOpt.getLogTargets(); - if(targets.empty()) { - cLog.addTarget("stderr:2"); - } - else { - StringList::const_iterator it; - for(it = targets.begin();it != targets.end(); ++it) - cLog.addTarget(*it); - } + for(StringList::const_iterator it = targets.begin();it != targets.end(); ++it) + cLog.addTarget(*it); } catch(syntax_error& e) { @@ -133,7 +130,7 @@ int main(int argc, char* argv[]) UDPPacketSource::proto::endpoint endpoint; // allow emtpy endpoint!!! gResolver.resolveUdp(gOpt.getRemoteAddr(), gOpt.getRemotePort(), - boost::bind(createConnection, _1, boost::ref(cl), gOpt.getSeqWindowSize(), boost::ref(queue), gOpt.getMux(), boost::ref(sem)), + boost::bind(createConnectionResolver, _1, boost::ref(cl), gOpt.getSeqWindowSize(), boost::ref(queue), gOpt.getMux(), boost::ref(sem)), boost::bind(createConnectionError, _1, boost::ref(sem), boost::ref(ret)), gOpt.getResolvAddrType()); sem.down();