mirror of
https://github.com/slackhq/nebula.git
synced 2026-08-15 09:57:00 +02:00
fix it!
This commit is contained in:
@@ -5,10 +5,8 @@ package udp
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
|
||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -17,10 +15,6 @@ import (
|
|||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testLogger() *slog.Logger {
|
|
||||||
return slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelError}))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TestShutdownWakesAfterRx_Mechanism exercises the kernel quirk our teardown
|
// TestShutdownWakesAfterRx_Mechanism exercises the kernel quirk our teardown
|
||||||
// relies on: once a socket has received a packet, shutdown(2) wakes a blocked
|
// relies on: once a socket has received a packet, shutdown(2) wakes a blocked
|
||||||
// recvmmsg with n>=1/Len==0 (not n==0). recvmmsg must turn that into net.ErrClosed
|
// recvmmsg with n>=1/Len==0 (not n==0). recvmmsg must turn that into net.ErrClosed
|
||||||
@@ -35,7 +29,7 @@ func TestShutdownWakesAfterRx_Mechanism(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("LocalAddr: %v", err)
|
t.Fatalf("LocalAddr: %v", err)
|
||||||
}
|
}
|
||||||
msgs, _, _ := sc.PrepareRawMessages(sc.batch)
|
msgs, _, _, _ := sc.PrepareRawMessages(sc.batch, 0xffff, 16)
|
||||||
|
|
||||||
// Receive a real packet so the socket has carried data.
|
// Receive a real packet so the socket has carried data.
|
||||||
send, err := net.Dial("udp", addr.String())
|
send, err := net.Dial("udp", addr.String())
|
||||||
@@ -134,9 +128,9 @@ func runTeardownCase(t *testing.T, batch int, name string, traffic func(send net
|
|||||||
var received atomic.Int64
|
var received atomic.Int64
|
||||||
loopDone := make(chan error, 1)
|
loopDone := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
loopDone <- sc.ListenOut(func(netip.AddrPort, []byte) {
|
loopDone <- sc.ListenOut(func(netip.AddrPort, []byte, RxMeta) {
|
||||||
received.Add(1)
|
received.Add(1)
|
||||||
})
|
}, func() {})
|
||||||
}()
|
}()
|
||||||
|
|
||||||
send, err := net.Dial("udp", addr.String())
|
send, err := net.Dial("udp", addr.String())
|
||||||
|
|||||||
Reference in New Issue
Block a user