cli: use new configuration for the RPC server

Also fix addresses if needed and store this new configuration.
This commit is contained in:
Roman Khimov 2022-07-26 16:19:51 +03:00
parent 94099de3c3
commit 6593b94594

View file

@ -542,15 +542,17 @@ Main:
log.Warn("ApplicationConfiguration changed in incompatible way, signal ignored") log.Warn("ApplicationConfiguration changed in incompatible way, signal ignored")
break // Continue working. break // Continue working.
} }
configureAddresses(&cfgnew.ApplicationConfiguration)
switch sig { switch sig {
case syscall.SIGHUP: case syscall.SIGHUP:
rpcServer.Shutdown() rpcServer.Shutdown()
rpcServer = rpcsrv.New(chain, cfg.ApplicationConfiguration.RPC, serv, oracleSrv, log, errChan) rpcServer = rpcsrv.New(chain, cfgnew.ApplicationConfiguration.RPC, serv, oracleSrv, log, errChan)
serv.AddService(&rpcServer) // Replaces old one by service name. serv.AddService(&rpcServer) // Replaces old one by service name.
if !cfg.ApplicationConfiguration.RPC.StartWhenSynchronized || serv.IsInSync() { if !cfgnew.ApplicationConfiguration.RPC.StartWhenSynchronized || serv.IsInSync() {
rpcServer.Start() rpcServer.Start()
} }
} }
cfg = cfgnew
case <-grace.Done(): case <-grace.Done():
signal.Stop(sighupCh) signal.Stop(sighupCh)
serv.Shutdown() serv.Shutdown()