MCPcopy
hub / github.com/WireGuard/wireguard-go / TestStdNetBindReceiveFuncAfterClose

Function TestStdNetBindReceiveFuncAfterClose

conn/bind_std_test.go:11–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestStdNetBindReceiveFuncAfterClose(t *testing.T) {
12 bind := NewStdNetBind().(*StdNetBind)
13 fns, _, err := bind.Open(0)
14 if err != nil {
15 t.Fatal(err)
16 }
17 bind.Close()
18 bufs := make([][]byte, 1)
19 bufs[0] = make([]byte, 1)
20 sizes := make([]int, 1)
21 eps := make([]Endpoint, 1)
22 for _, fn := range fns {
23 // The ReceiveFuncs must not access conn-related fields on StdNetBind
24 // unguarded. Close() nils the conn-related fields resulting in a panic
25 // if they violate the mutex.
26 fn(bufs, sizes, eps)
27 }
28}
29
30func mockSetGSOSize(control *[]byte, gsoSize uint16) {
31 *control = (*control)[:cap(*control)]

Callers

nothing calls this directly

Calls 3

NewStdNetBindFunction · 0.85
OpenMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected