mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
wgengine/magicsock: allow more time for pings to transit
We removed the "fast retry" code from our wireguard-go fork. As a result, pings can take longer to transit when retries are required. Allow that. Fixes #1277 Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
6d2b8df06d
commit
e1f773ebba
@ -928,6 +928,13 @@ func testTwoDevicePing(t *testing.T, d *devices) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In the normal case, pings succeed immediately.
|
||||||
|
// However, in the case of a handshake race, we need to retry.
|
||||||
|
// Typical retries take 5s. With very bad luck, we can need to retry
|
||||||
|
// multiple times. Give ourselves enough time for three retries
|
||||||
|
// plus a bit of processing time.
|
||||||
|
const pingTimeout = 16 * time.Second
|
||||||
|
|
||||||
ping1 := func(t *testing.T) {
|
ping1 := func(t *testing.T) {
|
||||||
msg2to1 := tuntest.Ping(net.ParseIP("1.0.0.1"), net.ParseIP("1.0.0.2"))
|
msg2to1 := tuntest.Ping(net.ParseIP("1.0.0.1"), net.ParseIP("1.0.0.2"))
|
||||||
m2.tun.Outbound <- msg2to1
|
m2.tun.Outbound <- msg2to1
|
||||||
@ -937,7 +944,7 @@ func testTwoDevicePing(t *testing.T, d *devices) {
|
|||||||
if !bytes.Equal(msg2to1, msgRecv) {
|
if !bytes.Equal(msg2to1, msgRecv) {
|
||||||
t.Error("ping did not transit correctly")
|
t.Error("ping did not transit correctly")
|
||||||
}
|
}
|
||||||
case <-time.After(3 * time.Second):
|
case <-time.After(pingTimeout):
|
||||||
t.Error("ping did not transit")
|
t.Error("ping did not transit")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -950,7 +957,7 @@ func testTwoDevicePing(t *testing.T, d *devices) {
|
|||||||
if !bytes.Equal(msg1to2, msgRecv) {
|
if !bytes.Equal(msg1to2, msgRecv) {
|
||||||
t.Error("return ping did not transit correctly")
|
t.Error("return ping did not transit correctly")
|
||||||
}
|
}
|
||||||
case <-time.After(3 * time.Second):
|
case <-time.After(pingTimeout):
|
||||||
t.Error("return ping did not transit")
|
t.Error("return ping did not transit")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -981,7 +988,7 @@ func testTwoDevicePing(t *testing.T, d *devices) {
|
|||||||
if !bytes.Equal(msg1to2, msgRecv) {
|
if !bytes.Equal(msg1to2, msgRecv) {
|
||||||
t.Error("return ping did not transit correctly")
|
t.Error("return ping did not transit correctly")
|
||||||
}
|
}
|
||||||
case <-time.After(3 * time.Second):
|
case <-time.After(pingTimeout):
|
||||||
t.Error("return ping did not transit")
|
t.Error("return ping did not transit")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1044,7 +1051,7 @@ func testTwoDevicePing(t *testing.T, d *devices) {
|
|||||||
t.Errorf("return ping %d did not transit correctly: %s", i, cmp.Diff(b, msgRecv))
|
t.Errorf("return ping %d did not transit correctly: %s", i, cmp.Diff(b, msgRecv))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case <-time.After(3 * time.Second):
|
case <-time.After(pingTimeout):
|
||||||
if strict {
|
if strict {
|
||||||
t.Errorf("return ping %d did not transit", i)
|
t.Errorf("return ping %d did not transit", i)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user