refactor: use maps.Copy for cleaner map handling
Signed-off-by: xinhangzhou <shuangcui@aliyun.com>
This commit is contained in:
1 parent
5235f3b24f
commit
b7e3c20383
7 files changed
+18
-28
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"math/big"
|
||||
"net"
|
||||
"sync"
|
||||
@@ -1252,9 +1253,7 @@ func (c *client) handleNewTower(tower *Tower) error {
|
||||
return fmt.Errorf("unable to determine sessions for tower %x: "+
|
||||
"%v", tower.IdentityKey.SerializeCompressed(), err)
|
||||
}
|
||||
for id, session := range sessions {
|
||||
c.candidateSessions[id] = session
|
||||
}
|
||||
maps.Copy(c.candidateSessions, sessions)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user