mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-06 21:01:56 +00:00
wgengine/magicsock: use NodeKey, not DiscoKey, as the trigger for lazy reconfig.
Updates #2752 Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
committed by
Dave Anderson
parent
4c27e2fa22
commit
dfd978f0f2
@@ -1117,17 +1117,26 @@ func TestDiscoStringLogRace(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test32bitAlignment(t *testing.T) {
|
||||
var de endpoint
|
||||
// Need an associated conn with non-nil noteRecvActivity to
|
||||
// trigger interesting work on the atomics in endpoint.
|
||||
called := 0
|
||||
de := endpoint{
|
||||
c: &Conn{
|
||||
noteRecvActivity: func(tailcfg.NodeKey) { called++ },
|
||||
},
|
||||
}
|
||||
|
||||
if off := unsafe.Offsetof(de.lastRecv); off%8 != 0 {
|
||||
t.Fatalf("endpoint.lastRecv is not 8-byte aligned")
|
||||
}
|
||||
|
||||
if !de.isFirstRecvActivityInAwhile() { // verify this doesn't panic on 32-bit
|
||||
t.Error("expected true")
|
||||
de.noteRecvActivity() // verify this doesn't panic on 32-bit
|
||||
if called != 1 {
|
||||
t.Fatal("expected call to noteRecvActivity")
|
||||
}
|
||||
if de.isFirstRecvActivityInAwhile() {
|
||||
t.Error("expected false on second call")
|
||||
de.noteRecvActivity()
|
||||
if called != 1 {
|
||||
t.Error("expected no second call to noteRecvActivity")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user