Merge pull request 'Fix Tor Reset to Update Settings and Avoid Contention on datadir' (#63) from custom_tor_config into trunk
continuous-integration/drone/push Build is passing Details

Reviewed-on: #63
This commit is contained in:
Dan Ballard 2022-01-19 21:09:04 +00:00
commit 84d451fb46
1 changed files with 9 additions and 1 deletions

10
lib.go
View File

@ -800,7 +800,15 @@ func c_ResetTor() {
func ResetTor() {
log.Infof("Replacing ACN with new Tor...")
globalACN.ReplaceACN(buildACN(*utils.ReadGlobalSettings(), globalTorPath, globalAppDir))
settings := utils.ReadGlobalSettings()
globalACN.Close() // we need to close first if dateDir is the same, otherwise buildACN can't launch tor.
globalACN.ReplaceACN(buildACN(*settings, globalTorPath, globalAppDir))
// We need to update settings on reset as buildACN can alter settings, otherwise the next reset will be broken...
settings = utils.ReadGlobalSettings()
settingsJson, _ := json.Marshal(settings)
application.GetPrimaryBus().Publish(event.NewEvent(utils.UpdateGlobalSettings, map[event.Field]string{event.Data: string(settingsJson)}))
log.Infof("Restarted")
}