mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-12-15 06:41:09 -08:00
tokio is needed by both temporal & gcloud pubsub, so make just one instance for the whole library, add init/shutdown functions for it exposed to C
This commit is contained in:
parent
4b3b847c7f
commit
837f15d01b
5 changed files with 65 additions and 16 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include <climits>
|
||||
#include <iomanip>
|
||||
#include <libpq-fe.h>
|
||||
#include <rustybits.h>
|
||||
#include <sstream>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
|
@ -43,6 +44,8 @@ CV2::CV2(const Identity& myId, const char* path, int listenPort) : DB(), _pool()
|
|||
auto span = tracer->StartSpan("cv2::CV2");
|
||||
auto scope = tracer->WithActiveSpan(span);
|
||||
|
||||
rustybits::init_async_runtime();
|
||||
|
||||
fprintf(stderr, "CV2::CV2\n");
|
||||
char myAddress[64];
|
||||
_myAddressStr = myId.address().toString(myAddress);
|
||||
|
|
@ -83,6 +86,8 @@ CV2::CV2(const Identity& myId, const char* path, int listenPort) : DB(), _pool()
|
|||
|
||||
CV2::~CV2()
|
||||
{
|
||||
rustybits::shutdown_async_runtime();
|
||||
|
||||
_run = 0;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue