Allow restarting Syncthing when the built-in Syncthing library is used

This commit is contained in:
Martchus 2024-06-20 01:30:12 +02:00
parent 8f78d14215
commit fa5a7b5c64
1 changed files with 11 additions and 4 deletions

View File

@ -164,10 +164,17 @@ std::int64_t runSyncthing(const RuntimeOptions &options)
if (!runningState) {
return -1;
}
return ::libst_run_syncthing(gostr(options.configDir), gostr(options.dataDir), gostr(options.guiAddress), gostr(options.guiApiKey),
options.flags & RuntimeFlags::Verbose, options.flags & RuntimeFlags::AllowNewerConfig, options.flags & RuntimeFlags::NoDefaultConfig,
options.flags & RuntimeFlags::SkipPortProbing, options.flags & RuntimeFlags::EnsureConfigDirExists,
options.flags & RuntimeFlags::EnsureDataDirExists, options.flags & RuntimeFlags::ExpandPathsFromEnv);
for (;;) {
const auto exitCode
= ::libst_run_syncthing(gostr(options.configDir), gostr(options.dataDir), gostr(options.guiAddress), gostr(options.guiApiKey),
options.flags & RuntimeFlags::Verbose, options.flags & RuntimeFlags::AllowNewerConfig, options.flags & RuntimeFlags::NoDefaultConfig,
options.flags & RuntimeFlags::SkipPortProbing, options.flags & RuntimeFlags::EnsureConfigDirExists,
options.flags & RuntimeFlags::EnsureDataDirExists, options.flags & RuntimeFlags::ExpandPathsFromEnv);
// return exit code unless it is "3" as this means Syncthing is supposed to be restarted
if (exitCode != 3) {
return exitCode;
}
}
}
/*!