GitHub issue #1019

This commit is contained in:
Adam Ierymenko 2019-09-04 12:21:51 -07:00
parent 3c0f54257b
commit 27c8eb0d6d
3 changed files with 25 additions and 7 deletions

View file

@ -113,7 +113,20 @@
<ClCompile Include="..\..\service\SoftwareUpdater.cpp" /> <ClCompile Include="..\..\service\SoftwareUpdater.cpp" />
<ClCompile Include="ServiceBase.cpp" /> <ClCompile Include="ServiceBase.cpp" />
<ClCompile Include="ServiceInstaller.cpp" /> <ClCompile Include="ServiceInstaller.cpp" />
<ClCompile Include="ZeroTierOneService.cpp" /> <ClCompile Include="ZeroTierOneService.cpp">
<FunctionLevelLinking Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</FunctionLevelLinking>
<EnableParallelCodeGeneration Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</EnableParallelCodeGeneration>
<FunctionLevelLinking Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</FunctionLevelLinking>
<EnableParallelCodeGeneration Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</EnableParallelCodeGeneration>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NoExtensions</EnableEnhancedInstructionSet>
<FloatingPointExceptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</FloatingPointExceptions>
<CreateHotpatchableImage Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CreateHotpatchableImage>
<FloatingPointExceptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</FloatingPointExceptions>
<CreateHotpatchableImage Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CreateHotpatchableImage>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\controller\DB.hpp" /> <ClInclude Include="..\..\controller\DB.hpp" />

View file

@ -76,9 +76,7 @@ restart_node:
ZeroTier::Mutex::Lock _l(_lock); ZeroTier::Mutex::Lock _l(_lock);
delete _service; delete _service;
_service = (ZeroTier::OneService *)0; // in case newInstance() fails _service = (ZeroTier::OneService *)0; // in case newInstance() fails
_service = ZeroTier::OneService::newInstance( _service = ZeroTier::OneService::newInstance(_path.c_str(), ZT_DEFAULT_PORT);
ZeroTier::OneService::platformDefaultHomePath().c_str(),
ZT_DEFAULT_PORT);
} }
switch(_service->run()) { switch(_service->run()) {
case ZeroTier::OneService::ONE_UNRECOVERABLE_ERROR: { case ZeroTier::OneService::ONE_UNRECOVERABLE_ERROR: {
@ -120,10 +118,16 @@ restart_node:
} }
} }
void ZeroTierOneService::OnStart(DWORD dwArgc, LPSTR *lpszArgv) void ZeroTierOneService::OnStart(DWORD dwArgc, PSTR *lpszArgv)
{ {
ZT_SVCDBG("ZeroTierOneService::OnStart()\r\n"); ZT_SVCDBG("ZeroTierOneService::OnStart()\r\n");
if ((dwArgc > 1)&&(lpszArgv[1])&&(strlen(lpszArgv[1]) > 0)) {
this->_path = lpszArgv[1];
} else {
this->_path = ZeroTier::OneService::platformDefaultHomePath();
}
try { try {
_thread = ZeroTier::Thread::start(this); _thread = ZeroTier::Thread::start(this);
} catch ( ... ) { } catch ( ... ) {

View file

@ -62,6 +62,7 @@ protected:
virtual void OnShutdown(); virtual void OnShutdown();
private: private:
std::string _path;
ZeroTier::OneService *volatile _service; ZeroTier::OneService *volatile _service;
ZeroTier::Mutex _lock; ZeroTier::Mutex _lock;
ZeroTier::Thread _thread; ZeroTier::Thread _thread;