Pull request: home: rm var shadowing, vol. 4
Closes #2803.
Squashed commit of the following:
commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Mar 12 14:21:46 2021 +0300
home: imp more
commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Mar 12 13:58:10 2021 +0300
all: imp naming, refactor http srv shutdown
commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa
Merge: 2247c05b bfbf73f3
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Mar 12 13:35:17 2021 +0300
Merge branch 'master' into 2803-shadow-4
commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jan 29 20:53:21 2021 +0300
home: rm var shadowing, vol. 4
This commit is contained in:
@@ -517,7 +517,7 @@ func (clients *clientsContainer) Update(name string, c *Client) (err error) {
|
||||
return agherr.Error("client not found")
|
||||
}
|
||||
|
||||
// check Name index
|
||||
// First, check the name index.
|
||||
if prev.Name != c.Name {
|
||||
_, ok = clients.list[c.Name]
|
||||
if ok {
|
||||
@@ -525,12 +525,12 @@ func (clients *clientsContainer) Update(name string, c *Client) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
// check IP index
|
||||
// Second, check the IP index.
|
||||
if !equalStringSlices(prev.IDs, c.IDs) {
|
||||
for _, id := range c.IDs {
|
||||
c2, ok := clients.idIndex[id]
|
||||
if ok && c2 != prev {
|
||||
return fmt.Errorf("another client uses the same ID (%q): %q", id, c2.Name)
|
||||
c2, ok2 := clients.idIndex[id]
|
||||
if ok2 && c2 != prev {
|
||||
return fmt.Errorf("another client uses the same id (%q): %q", id, c2.Name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user