wgengine/magicsock: rename discoEndpoint to just endpoint.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2021-08-25 22:20:31 -07:00
committed by Dave Anderson
parent f2d949e2db
commit 8049063d35
2 changed files with 83 additions and 86 deletions

View File

@@ -1051,7 +1051,7 @@ func TestDiscoMessage(t *testing.T) {
DiscoKey: peer1Pub,
}
c.peerMap.upsertNode(n)
c.peerMap.upsertDiscoEndpoint(&discoEndpoint{
c.peerMap.upsertDiscoEndpoint(&endpoint{
publicKey: n.Key,
discoKey: n.DiscoKey,
})
@@ -1071,12 +1071,12 @@ func TestDiscoMessage(t *testing.T) {
}
}
// tests that having a discoEndpoint.String prevents wireguard-go's
// tests that having a endpoint.String prevents wireguard-go's
// log.Printf("%v") of its conn.Endpoint values from using reflect to
// walk into read mutex while they're being used and then causing data
// races.
func TestDiscoStringLogRace(t *testing.T) {
de := new(discoEndpoint)
de := new(endpoint)
var wg sync.WaitGroup
wg.Add(2)
go func() {
@@ -1091,10 +1091,10 @@ func TestDiscoStringLogRace(t *testing.T) {
}
func Test32bitAlignment(t *testing.T) {
var de discoEndpoint
var de endpoint
if off := unsafe.Offsetof(de.lastRecv); off%8 != 0 {
t.Fatalf("discoEndpoint.lastRecv is not 8-byte aligned")
t.Fatalf("endpoint.lastRecv is not 8-byte aligned")
}
if !de.isFirstRecvActivityInAwhile() { // verify this doesn't panic on 32-bit
@@ -1350,7 +1350,7 @@ func TestSetNetworkMapChangingNodeKey(t *testing.T) {
})
}
de, ok := conn.peerMap.discoEndpointForDiscoKey(discoKey)
de, ok := conn.peerMap.endpointForDiscoKey(discoKey)
if ok && de.publicKey != nodeKey2 {
t.Fatalf("discoEndpoint public key = %q; want %q", de.publicKey[:], nodeKey2[:])
}