From e7e444e2fc7edbe90d88ac201b7d038b18e5e04e Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 3 Feb 2020 11:13:13 +0300 Subject: [PATCH] Remove unnecessary skysocks/skysocks-client restarts, improve logging 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 --- pkg/visor/visor.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/visor/visor.go b/pkg/visor/visor.go index 6385e82df6..835e00a1fc 100644 --- a/pkg/visor/visor.go +++ b/pkg/visor/visor.go @@ -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 { @@ -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) {