mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-02 22:12:53 +03:00
Pull request: dhcpd: add purge, imp code
Updates #1691. Squashed commit of the following: commit 2ce6cc005d09ac7d63e4e575705d86e92046697f Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Jun 16 16:42:57 2021 +0300 dhcp: imp code commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Jun 16 16:27:06 2021 +0300 dhcpd: add purge, imp code
This commit is contained in:
parent
ce36c955df
commit
84e71e912e
19 changed files with 481 additions and 251 deletions
internal/home
|
@ -241,8 +241,8 @@ func setupConfig(args options) (err error) {
|
|||
config.DHCP.HTTPRegister = httpRegister
|
||||
config.DHCP.ConfigModified = onConfigModified
|
||||
|
||||
Context.dhcpServer = dhcpd.Create(config.DHCP)
|
||||
if Context.dhcpServer == nil {
|
||||
Context.dhcpServer, err = dhcpd.Create(config.DHCP)
|
||||
if Context.dhcpServer == nil || err != nil {
|
||||
// TODO(a.garipov): There are a lot of places in the code right
|
||||
// now which assume that the DHCP server can be nil despite this
|
||||
// condition. Inspect them and perhaps rewrite them to use
|
||||
|
@ -630,7 +630,7 @@ func configureLogger(args options) {
|
|||
|
||||
// cleanup stops and resets all the modules.
|
||||
func cleanup(ctx context.Context) {
|
||||
log.Info("Stopping AdGuard Home")
|
||||
log.Info("stopping AdGuard Home")
|
||||
|
||||
if Context.web != nil {
|
||||
Context.web.Close(ctx)
|
||||
|
@ -643,11 +643,14 @@ func cleanup(ctx context.Context) {
|
|||
|
||||
err := stopDNSServer()
|
||||
if err != nil {
|
||||
log.Error("Couldn't stop DNS server: %s", err)
|
||||
log.Error("stopping dns server: %s", err)
|
||||
}
|
||||
|
||||
if Context.dhcpServer != nil {
|
||||
Context.dhcpServer.Stop()
|
||||
err = Context.dhcpServer.Stop()
|
||||
if err != nil {
|
||||
log.Error("stopping dhcp server: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
Context.etcHosts.Close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue