zts_start initialization order fix for ztproxy. Was creating Phy instance before calling WSAStartup on Windows

This commit is contained in:
Joseph Henry
2017-10-10 12:22:57 -07:00
parent 35aa1820ef
commit f9754d8216

View File

@@ -63,10 +63,6 @@ namespace ZeroTier {
_internal_addr(internal_addr), _internal_addr(internal_addr),
_phy(this,false,true) _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 // Set up TCP listen sockets
// IPv4 // IPv4
struct sockaddr_in in4; struct sockaddr_in in4;
@@ -380,6 +376,11 @@ int main(int argc, char **argv)
int internal_port = atoi(argv[5]); int internal_port = atoi(argv[5]);
std::string dns_nameserver= "";//argv[6]; 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); ZeroTier::ZTProxy *proxy = new ZeroTier::ZTProxy(proxy_listen_port, nwid, path, internal_addr, internal_port, dns_nameserver);
if (proxy) { if (proxy) {