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:
Roman Khimov 2022-07-27 12:51:41 +03:00
parent e1ef3c45ce
commit b92896b0c0
3 changed files with 31 additions and 7 deletions

View file

@ -8,7 +8,6 @@ import (
"os"
"os/signal"
"runtime"
"syscall"
"time"
"github.com/nspcc-dev/neo-go/cli/options"
@ -516,9 +515,9 @@ func startServer(ctx *cli.Context) error {
}
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, syscall.SIGHUP)
signal.Notify(sigCh, syscall.SIGUSR1)
signal.Notify(sigCh, syscall.SIGUSR2)
signal.Notify(sigCh, sighup)
signal.Notify(sigCh, sigusr1)
signal.Notify(sigCh, sigusr2)
fmt.Fprintln(ctx.App.Writer, Logo())
fmt.Fprintln(ctx.App.Writer, serv.UserAgent)
@ -548,7 +547,7 @@ Main:
}
configureAddresses(&cfgnew.ApplicationConfiguration)
switch sig {
case syscall.SIGHUP:
case sighup:
serv.DelService(&rpcServer)
rpcServer.Shutdown()
rpcServer = rpcsrv.New(chain, cfgnew.ApplicationConfiguration.RPC, serv, oracleSrv, log, errChan)
@ -562,7 +561,7 @@ Main:
prometheus.ShutDown()
prometheus = metrics.NewPrometheusService(cfgnew.ApplicationConfiguration.Prometheus, log)
go prometheus.Start()
case syscall.SIGUSR1:
case sigusr1:
if oracleSrv != nil {
serv.DelService(oracleSrv)
chain.SetOracle(nil)
@ -605,7 +604,7 @@ Main:
if serv.IsInSync() {
sr.Start()
}
case syscall.SIGUSR2:
case sigusr2:
if dbftSrv != nil {
serv.DelExtensibleHPService(dbftSrv, consensus.Category)
dbftSrv.Shutdown()

View file

@ -0,0 +1,12 @@
//go:build !windows
// +build !windows
package server
import "syscall"
const (
sighup = syscall.SIGHUP
sigusr1 = syscall.SIGUSR1
sigusr2 = syscall.SIGUSR2
)

View 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)
)