cli: fix FTBFS on Windows
It has a stub for SIGHUP, but doesn't have anything for USR1 and USR2: Error: cli\server\server.go:520:31: undefined: syscall.SIGUSR1 Error: cli\server\server.go:521:31: undefined: syscall.SIGUSR2 Error: cli\server\server.go:565:17: undefined: syscall.SIGUSR1 Error: cli\server\server.go:608:17: undefined: syscall.SIGUSR2
This commit is contained in:
parent
e1ef3c45ce
commit
b92896b0c0
3 changed files with 31 additions and 7 deletions
|
@ -8,7 +8,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/cli/options"
|
"github.com/nspcc-dev/neo-go/cli/options"
|
||||||
|
@ -516,9 +515,9 @@ func startServer(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
sigCh := make(chan os.Signal, 1)
|
sigCh := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigCh, syscall.SIGHUP)
|
signal.Notify(sigCh, sighup)
|
||||||
signal.Notify(sigCh, syscall.SIGUSR1)
|
signal.Notify(sigCh, sigusr1)
|
||||||
signal.Notify(sigCh, syscall.SIGUSR2)
|
signal.Notify(sigCh, sigusr2)
|
||||||
|
|
||||||
fmt.Fprintln(ctx.App.Writer, Logo())
|
fmt.Fprintln(ctx.App.Writer, Logo())
|
||||||
fmt.Fprintln(ctx.App.Writer, serv.UserAgent)
|
fmt.Fprintln(ctx.App.Writer, serv.UserAgent)
|
||||||
|
@ -548,7 +547,7 @@ Main:
|
||||||
}
|
}
|
||||||
configureAddresses(&cfgnew.ApplicationConfiguration)
|
configureAddresses(&cfgnew.ApplicationConfiguration)
|
||||||
switch sig {
|
switch sig {
|
||||||
case syscall.SIGHUP:
|
case sighup:
|
||||||
serv.DelService(&rpcServer)
|
serv.DelService(&rpcServer)
|
||||||
rpcServer.Shutdown()
|
rpcServer.Shutdown()
|
||||||
rpcServer = rpcsrv.New(chain, cfgnew.ApplicationConfiguration.RPC, serv, oracleSrv, log, errChan)
|
rpcServer = rpcsrv.New(chain, cfgnew.ApplicationConfiguration.RPC, serv, oracleSrv, log, errChan)
|
||||||
|
@ -562,7 +561,7 @@ Main:
|
||||||
prometheus.ShutDown()
|
prometheus.ShutDown()
|
||||||
prometheus = metrics.NewPrometheusService(cfgnew.ApplicationConfiguration.Prometheus, log)
|
prometheus = metrics.NewPrometheusService(cfgnew.ApplicationConfiguration.Prometheus, log)
|
||||||
go prometheus.Start()
|
go prometheus.Start()
|
||||||
case syscall.SIGUSR1:
|
case sigusr1:
|
||||||
if oracleSrv != nil {
|
if oracleSrv != nil {
|
||||||
serv.DelService(oracleSrv)
|
serv.DelService(oracleSrv)
|
||||||
chain.SetOracle(nil)
|
chain.SetOracle(nil)
|
||||||
|
@ -605,7 +604,7 @@ Main:
|
||||||
if serv.IsInSync() {
|
if serv.IsInSync() {
|
||||||
sr.Start()
|
sr.Start()
|
||||||
}
|
}
|
||||||
case syscall.SIGUSR2:
|
case sigusr2:
|
||||||
if dbftSrv != nil {
|
if dbftSrv != nil {
|
||||||
serv.DelExtensibleHPService(dbftSrv, consensus.Category)
|
serv.DelExtensibleHPService(dbftSrv, consensus.Category)
|
||||||
dbftSrv.Shutdown()
|
dbftSrv.Shutdown()
|
||||||
|
|
12
cli/server/signals_unix.go
Normal file
12
cli/server/signals_unix.go
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
const (
|
||||||
|
sighup = syscall.SIGHUP
|
||||||
|
sigusr1 = syscall.SIGUSR1
|
||||||
|
sigusr2 = syscall.SIGUSR2
|
||||||
|
)
|
13
cli/server/signals_windows.go
Normal file
13
cli/server/signals_windows.go
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Doesn't really matter, Windows can't do it.
|
||||||
|
sighup = syscall.SIGHUP
|
||||||
|
sigusr1 = syscall.Signal(0xa)
|
||||||
|
sigusr2 = syscall.Signal(0xc)
|
||||||
|
)
|
Loading…
Reference in a new issue