diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index d45f306e6..4be09951e 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -1,5 +1,5 @@ - + @@ -23,7 +23,7 @@ - + @@ -123,8 +123,8 @@ - - + + @@ -205,7 +205,6 @@ - @@ -235,7 +234,6 @@ - @@ -253,7 +251,7 @@ - + @@ -262,8 +260,6 @@ - - @@ -314,8 +310,8 @@ - - + + diff --git a/osdep/WindowsEthernetTap.cpp b/osdep/WindowsEthernetTap.cpp index 4a5d32a48..1cea0d96c 100644 --- a/osdep/WindowsEthernetTap.cpp +++ b/osdep/WindowsEthernetTap.cpp @@ -594,7 +594,10 @@ void WindowsEthernetTap::threadMain() Utils::snprintf(tapPath,sizeof(tapPath),"\\\\.\\Global\\%s.tap",_netCfgInstanceId.c_str()); int prevTapResetStatus = _systemTapResetStatus; + bool throwOneAway = true; // "Power cycle" the network port once on startup, because Windows... while (_run) { + Sleep(500); + _tap = CreateFileA(tapPath,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_SYSTEM|FILE_FLAG_OVERLAPPED,NULL); if (_tap == INVALID_HANDLE_VALUE) { fprintf(stderr,"Error opening %s -- retrying.\r\n",tapPath); @@ -698,7 +701,8 @@ void WindowsEthernetTap::threadMain() ReadFile(_tap,tapReadBuf,sizeof(tapReadBuf),NULL,&tapOvlRead); bool writeInProgress = false; while (_run) { - if (prevTapResetStatus != _systemTapResetStatus) { + if ((prevTapResetStatus != _systemTapResetStatus)||(throwOneAway)) { + throwOneAway = false; prevTapResetStatus = _systemTapResetStatus; break; // this will cause us to close and reopen the tap } diff --git a/service/OneService.cpp b/service/OneService.cpp index fc2fba419..a566449fa 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -523,7 +523,7 @@ public: { TcpConnection *tc = reinterpret_cast(*uptr); if (tc->writeBuf.length()) { - long sent = _phy.tcpSend(sock,tc->writeBuf.data(),tc->writeBuf.length(),true); + long sent = (long)_phy.tcpSend(sock,tc->writeBuf.data(),(unsigned long)tc->writeBuf.length(),true); if (sent > 0) { tc->lastActivity = OSUtils::now(); if ((unsigned long)sent == (unsigned long)tc->writeBuf.length()) {