Skip to content

Commit

Permalink
Remove unnecessary skysocks/skysocks-client restarts, improve logging
Browse files Browse the repository at this point in the history
Now skysocks is being restarted on password change only if it's been running at the moment.
Same goes for skysocks-client and PK change. Logging is changed to cohere with the process
  • Loading branch information
Darkren committed Feb 3, 2020
1 parent 573439c commit e7e444e
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pkg/visor/visor.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,14 @@ func (node *Node) setSocksPassword(password string) error {
return err
}

node.logger.Infof("Updated %v password, restarting it", socksName)
if node.procManager.Exists(socksName) {
node.logger.Infof("Updated %v password, restarting it", socksName)
return node.RestartApp(socksName)
}

node.logger.Infof("Updated %v password", socksName)

return node.RestartApp(socksName)
return nil
}

func (node *Node) setSocksClientPK(pk cipher.PubKey) error {
Expand All @@ -620,9 +625,14 @@ func (node *Node) setSocksClientPK(pk cipher.PubKey) error {
return err
}

node.logger.Infof("Updated %v PK, restarting it", socksClientName)
if node.procManager.Exists(socksClientName) {
node.logger.Infof("Updated %v PK, restarting it", socksClientName)
return node.RestartApp(socksClientName)
}

node.logger.Infof("Updated %v PK", socksClientName)

return node.RestartApp(socksClientName)
return nil
}

func (node *Node) updateArg(config *Config, appName, argName, value string) {
Expand Down

0 comments on commit e7e444e

Please sign in to comment.