Pull request 1977: 6100-fix-query-log
Updates #6100. Squashed commit of the following: commit f8a37b46620c8fbe7ff1cf06b70af3805c9dc049 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Aug 28 14:08:41 2023 +0300 home: imp code commit 2dd357fa3b41c36cec10ba136d4aecb0e41dbba3 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Aug 25 19:35:42 2023 +0300 all: imp docs commit 369f17897ab6befa78af163bead5deb8ceac0fa1 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Aug 25 19:26:14 2023 +0300 all: upd chlog commit c07d80ee437a9eeef547d308d00bcd12d52ed8ff Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Fri Aug 25 16:22:58 2023 +0300 home: fix more commit 3872806618d09b7eaa19eb1ce5cd8df2d55c10ff Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Aug 24 15:35:22 2023 +0300 home: fix query log
This commit is contained in:
@@ -33,7 +33,7 @@ const (
|
||||
// daemon.
|
||||
type program struct {
|
||||
clientBuildFS fs.FS
|
||||
signals chan os.Signal
|
||||
done chan struct{}
|
||||
opts options
|
||||
}
|
||||
|
||||
@@ -46,19 +46,16 @@ func (p *program) Start(_ service.Service) (err error) {
|
||||
args := p.opts
|
||||
args.runningAsService = true
|
||||
|
||||
go run(args, p.clientBuildFS)
|
||||
go run(args, p.clientBuildFS, p.done)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop implements service.Interface interface for *program.
|
||||
func (p *program) Stop(_ service.Service) (err error) {
|
||||
select {
|
||||
case p.signals <- syscall.SIGINT:
|
||||
// Go on.
|
||||
default:
|
||||
// Stop should not block.
|
||||
}
|
||||
log.Info("service: stopping: waiting for cleanup")
|
||||
|
||||
<-p.done
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -198,7 +195,7 @@ func restartService() (err error) {
|
||||
// - run: This is a special command that is not supposed to be used directly
|
||||
// it is specified when we register a service, and it indicates to the app
|
||||
// that it is being run as a service/daemon.
|
||||
func handleServiceControlAction(opts options, clientBuildFS fs.FS, signals chan os.Signal) {
|
||||
func handleServiceControlAction(opts options, clientBuildFS fs.FS, done chan struct{}) {
|
||||
// Call chooseSystem explicitly to introduce OpenBSD support for service
|
||||
// package. It's a noop for other GOOS values.
|
||||
chooseSystem()
|
||||
@@ -232,7 +229,7 @@ func handleServiceControlAction(opts options, clientBuildFS fs.FS, signals chan
|
||||
|
||||
s, err := service.New(&program{
|
||||
clientBuildFS: clientBuildFS,
|
||||
signals: signals,
|
||||
done: done,
|
||||
opts: runOpts,
|
||||
}, svcConfig)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user