From f9754d82162d0e1a25fcab77dcf5ce3809b97cb4 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 10 Oct 2017 12:22:57 -0700 Subject: [PATCH] zts_start initialization order fix for ztproxy. Was creating Phy instance before calling WSAStartup on Windows --- examples/ztproxy/ztproxy.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/ztproxy/ztproxy.cpp b/examples/ztproxy/ztproxy.cpp index d5a913c..07f5fbb 100644 --- a/examples/ztproxy/ztproxy.cpp +++ b/examples/ztproxy/ztproxy.cpp @@ -63,10 +63,6 @@ namespace ZeroTier { _internal_addr(internal_addr), _phy(this,false,true) { - // Start ZeroTier Node - // Join Network which contains resources we need to proxy - DEBUG_INFO("waiting for libzt to come online"); - zts_simple_start(path.c_str(), nwid.c_str()); // Set up TCP listen sockets // IPv4 struct sockaddr_in in4; @@ -380,6 +376,11 @@ int main(int argc, char **argv) int internal_port = atoi(argv[5]); std::string dns_nameserver= "";//argv[6]; + // Start ZeroTier Node + // Join Network which contains resources we need to proxy + DEBUG_INFO("waiting for libzt to come online"); + zts_simple_start(path.c_str(), nwid.c_str()); + ZeroTier::ZTProxy *proxy = new ZeroTier::ZTProxy(proxy_listen_port, nwid, path, internal_addr, internal_port, dns_nameserver); if (proxy) {