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="ServiceBase.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>
<ClInclude Include="..\..\controller\DB.hpp" />

View File

@ -76,9 +76,7 @@ restart_node:
ZeroTier::Mutex::Lock _l(_lock);
delete _service;
_service = (ZeroTier::OneService *)0; // in case newInstance() fails
_service = ZeroTier::OneService::newInstance(
ZeroTier::OneService::platformDefaultHomePath().c_str(),
ZT_DEFAULT_PORT);
_service = ZeroTier::OneService::newInstance(_path.c_str(), ZT_DEFAULT_PORT);
}
switch(_service->run()) {
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");
if ((dwArgc > 1)&&(lpszArgv[1])&&(strlen(lpszArgv[1]) > 0)) {
this->_path = lpszArgv[1];
} else {
this->_path = ZeroTier::OneService::platformDefaultHomePath();
}
try {
_thread = ZeroTier::Thread::start(this);
} catch ( ... ) {

View File

@ -57,11 +57,12 @@ public:
throw();
protected:
virtual void OnStart(DWORD dwArgc, PSTR *pszArgv);
virtual void OnStop();
virtual void OnStart(DWORD dwArgc, PSTR *pszArgv);
virtual void OnStop();
virtual void OnShutdown();
private:
std::string _path;
ZeroTier::OneService *volatile _service;
ZeroTier::Mutex _lock;
ZeroTier::Thread _thread;