Changeset View
Changeset View
Standalone View
Standalone View
src/torcontrol.cpp
Show All 9 Lines | |||||
#include <compat.h> | #include <compat.h> | ||||
#include <crypto/hmac_sha256.h> | #include <crypto/hmac_sha256.h> | ||||
#include <net.h> | #include <net.h> | ||||
#include <netaddress.h> | #include <netaddress.h> | ||||
#include <netbase.h> | #include <netbase.h> | ||||
#include <util/readwritefile.h> | #include <util/readwritefile.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <util/thread.h> | |||||
#include <util/time.h> | #include <util/time.h> | ||||
#include <boost/algorithm/string/classification.hpp> | #include <boost/algorithm/string/classification.hpp> | ||||
#include <boost/algorithm/string/replace.hpp> | #include <boost/algorithm/string/replace.hpp> | ||||
#include <boost/algorithm/string/split.hpp> | #include <boost/algorithm/string/split.hpp> | ||||
#include <boost/signals2/signal.hpp> | #include <boost/signals2/signal.hpp> | ||||
#include <event2/buffer.h> | #include <event2/buffer.h> | ||||
▲ Show 20 Lines • Show All 811 Lines • ▼ Show 20 Lines | #else | ||||
evthread_use_pthreads(); | evthread_use_pthreads(); | ||||
#endif | #endif | ||||
gBase = event_base_new(); | gBase = event_base_new(); | ||||
if (!gBase) { | if (!gBase) { | ||||
LogPrintf("tor: Unable to create event_base\n"); | LogPrintf("tor: Unable to create event_base\n"); | ||||
return; | return; | ||||
} | } | ||||
torControlThread = std::thread( | torControlThread = | ||||
&TraceThread<std::function<void()>>, "torcontrol", | std::thread(&util::TraceThread, "torcontrol", [onion_service_target] { | ||||
[onion_service_target] { TorControlThread(onion_service_target); }); | TorControlThread(onion_service_target); | ||||
}); | |||||
} | } | ||||
void InterruptTorControl() { | void InterruptTorControl() { | ||||
if (gBase) { | if (gBase) { | ||||
LogPrintf("tor: Thread interrupt\n"); | LogPrintf("tor: Thread interrupt\n"); | ||||
event_base_once( | event_base_once( | ||||
gBase, -1, EV_TIMEOUT, | gBase, -1, EV_TIMEOUT, | ||||
[](evutil_socket_t, short, void *) { event_base_loopbreak(gBase); }, | [](evutil_socket_t, short, void *) { event_base_loopbreak(gBase); }, | ||||
Show All 17 Lines |