Merge: - dhcp: web handlers were not registered when DHCP server is disabled

Close #1552

* commit '43704901384fe35785383b27a1ad0bd7d430830c':
  - dhcp: web handlers were not registered when DHCP server is disabled
This commit is contained in:
Simon Zolin 2020-04-07 11:54:29 +03:00
commit 105e2dd1ee
1 changed files with 5 additions and 6 deletions

View File

@ -124,6 +124,11 @@ func Create(config ServerConfig) *Server {
} }
} }
if !webHandlersRegistered && s.conf.HTTPRegister != nil {
webHandlersRegistered = true
s.registerHandlers()
}
// we can't delay database loading until DHCP server is started, // we can't delay database loading until DHCP server is started,
// because we need static leases functionality available beforehand // because we need static leases functionality available beforehand
s.dbLoad() s.dbLoad()
@ -219,12 +224,6 @@ func (s *Server) setConfig(config ServerConfig) error {
// Start will listen on port 67 and serve DHCP requests. // Start will listen on port 67 and serve DHCP requests.
func (s *Server) Start() error { func (s *Server) Start() error {
if !webHandlersRegistered && s.conf.HTTPRegister != nil {
webHandlersRegistered = true
s.registerHandlers()
}
// TODO: don't close if interface and addresses are the same // TODO: don't close if interface and addresses are the same
if s.conn != nil { if s.conn != nil {
_ = s.closeConn() _ = s.closeConn()