MCPcopy
hub / github.com/cloudflare/tableflip / TestFdsAddPacketConn

Function TestFdsAddPacketConn

fds_test.go:36–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestFdsAddPacketConn(t *testing.T) {
37 socketPath, cleanup := tempSocket(t)
38 defer cleanup()
39
40 addrs := [][2]string{
41 {"unix", socketPath},
42 {"udp", "localhost:0"},
43 }
44
45 fds := newFds(nil, nil)
46 for _, addr := range addrs {
47 conn, err := net.ListenPacket(addr[0], addr[1])
48 if err != nil {
49 t.Fatal(err)
50 }
51 if err := fds.AddPacketConn(addr[0], addr[1], conn.(PacketConn)); err != nil {
52 t.Fatalf("Can't add %s listener: %s", addr[0], err)
53 }
54 conn.Close()
55 }
56}
57
58func tempSocket(t *testing.T) (string, func()) {
59 t.Helper()

Callers

nothing calls this directly

Calls 4

tempSocketFunction · 0.85
newFdsFunction · 0.85
ListenPacketMethod · 0.80
AddPacketConnMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…