Pull request: 2509 type-safety vol.1

Merge in DNS/adguard-home from 2509-type-safety to master

Updates #2509.

Squashed commit of the following:

commit 535968eb7de3a9e0817ddb57bc2320e5c5a55086
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Jan 20 15:06:16 2021 +0300

    dhcpd: fix comments

commit dc79b80381fe7a8ecec6f9659fd23710c9229f59
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Jan 20 14:08:10 2021 +0300

    all: improve docs

commit 156ebf6c9bad95f82cd121f019f3b59b77b18ba6
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jan 19 17:08:15 2021 +0300

    all: improve JSON encoding and decoding
This commit is contained in:
Eugene Burkov
2021-01-20 15:59:24 +03:00
parent 715df4cd92
commit 5a50efadb2
8 changed files with 202 additions and 180 deletions

View File

@@ -77,7 +77,10 @@ func (s *v4Server) blacklisted(l *Lease) bool {
// GetLeases returns the list of current DHCP leases (thread-safe)
func (s *v4Server) GetLeases(flags int) []Lease {
var result []Lease
// The function shouldn't return nil value because zero-length slice
// behaves differently in cases like marshalling. Our front-end also
// requires non-nil value in the response.
result := []Lease{}
now := time.Now().Unix()
s.leasesLock.Lock()