refactor: use maps.Copy for cleaner map handling

Signed-off-by: xinhangzhou <shuangcui@aliyun.com>
This commit is contained in:
xinhangzhou
2025-03-24 17:13:47 +08:00
parent 5235f3b24f
commit b7e3c20383
7 changed files with 18 additions and 28 deletions

View File

@@ -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
}