mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-03 06:22:56 +03:00
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:
parent
2c9dcc12ff
commit
59a4a009a0
4 changed files with 18 additions and 20 deletions
internal/home
|
@ -99,8 +99,11 @@ func Main(clientBuildFS fs.FS) {
|
|||
// package flag.
|
||||
opts := loadCmdLineOpts()
|
||||
|
||||
done := make(chan struct{})
|
||||
|
||||
signals := make(chan os.Signal, 1)
|
||||
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGQUIT)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
sig := <-signals
|
||||
|
@ -112,19 +115,19 @@ func Main(clientBuildFS fs.FS) {
|
|||
default:
|
||||
cleanup(context.Background())
|
||||
cleanupAlways()
|
||||
os.Exit(0)
|
||||
close(done)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
if opts.serviceControlAction != "" {
|
||||
handleServiceControlAction(opts, clientBuildFS, signals)
|
||||
handleServiceControlAction(opts, clientBuildFS, done)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// run the protection
|
||||
run(opts, clientBuildFS)
|
||||
run(opts, clientBuildFS, done)
|
||||
}
|
||||
|
||||
// setupContext initializes [Context] fields. It also reads and upgrades
|
||||
|
@ -504,7 +507,7 @@ func fatalOnError(err error) {
|
|||
}
|
||||
|
||||
// run configures and starts AdGuard Home.
|
||||
func run(opts options, clientBuildFS fs.FS) {
|
||||
func run(opts options, clientBuildFS fs.FS, done chan struct{}) {
|
||||
// Configure config filename.
|
||||
initConfigFilename(opts)
|
||||
|
||||
|
@ -609,8 +612,8 @@ func run(opts options, clientBuildFS fs.FS) {
|
|||
|
||||
Context.web.start()
|
||||
|
||||
// Wait indefinitely for other goroutines to complete their job.
|
||||
select {}
|
||||
// Wait for other goroutines to complete their job.
|
||||
<-done
|
||||
}
|
||||
|
||||
// initUsers initializes context auth module. Clears config users field.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue