all: imp chlog
This commit is contained in:
parent
fcca9afe0c
commit
7c2b26e3ec
|
@ -32,9 +32,13 @@ NOTE: Add new changes BELOW THIS COMMENT.
|
|||
- Private rDNS resolution now also affects `SOA` and `NS` requests ([#6882]).
|
||||
- Rewrite rules mechanics was changed due to improve resolving in safe search.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Incorrect values for persistent client fields in the configuration file.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Acceptance of duplicate UIDs for persistent clients at startup. See also a
|
||||
- Acceptance of duplicate UIDs for persistent clients at startup. See also the
|
||||
section on client settings on the [Wiki page][wiki-config].
|
||||
- Issues with QUIC and HTTP/3 upstreams on older Linux kernel versions
|
||||
([#6422]).
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"net/netip"
|
||||
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/aghalg"
|
||||
"github.com/AdguardTeam/golibs/errors"
|
||||
)
|
||||
|
||||
// macKey contains MAC as byte array of 6, 8, or 20 bytes.
|
||||
|
@ -82,21 +83,25 @@ func (ci *Index) Add(c *Persistent) {
|
|||
ci.uidToClient[c.UID] = c
|
||||
}
|
||||
|
||||
// ErrDuplicateUID is an error returned by [Index.Clashes] when adding a
|
||||
// persistent client with a UID that already exists in an index.
|
||||
const ErrDuplicateUID errors.Error = "duplicate uid"
|
||||
|
||||
// Clashes returns an error if the index contains a different persistent client
|
||||
// with at least a single identifier contained by c. c must be non-nil.
|
||||
func (ci *Index) Clashes(c *Persistent) (err error) {
|
||||
p, ok := ci.uidToClient[c.UID]
|
||||
_, ok := ci.uidToClient[c.UID]
|
||||
if ok {
|
||||
return fmt.Errorf("another client %q uses the same UID", p.Name)
|
||||
return ErrDuplicateUID
|
||||
}
|
||||
|
||||
for _, id := range c.ClientIDs {
|
||||
var existing UID
|
||||
existing, ok = ci.clientIDToUID[id]
|
||||
if ok && existing != c.UID {
|
||||
p = ci.uidToClient[existing]
|
||||
p := ci.uidToClient[existing]
|
||||
|
||||
return fmt.Errorf("another client %q uses the same ID %q", p.Name, id)
|
||||
return fmt.Errorf("another client %q uses the same ClientID %q", p.Name, id)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,13 @@ func (clients *clientsContainer) addFromConfig(
|
|||
|
||||
_, err = clients.add(cli)
|
||||
if err != nil {
|
||||
return fmt.Errorf("clients: adding client at index %d %s: %w", i, cli.Name, err)
|
||||
if errors.Is(err, client.ErrDuplicateUID) {
|
||||
return fmt.Errorf("clients: adding client %s at index %d: %w", cli.Name, i, err)
|
||||
}
|
||||
|
||||
// TODO(s.chzhen): Return an error instead of logging if more
|
||||
// stringent requirements are implemented.
|
||||
log.Error("clients: adding client %s at index %d: %s", cli.Name, i, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue