MCPcopy Create free account
hub / github.com/cloudwego/netpoll / TestConnectionReadAfterClosed

Function TestConnectionReadAfterClosed

connection_test.go:196–214  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

194}
195
196func TestConnectionReadAfterClosed(t *testing.T) {
197 r, w := GetSysFdPairs()
198 rconn := &connection{}
199 rconn.init(&netFD{fd: r}, nil)
200 size := 256
201 msg := make([]byte, size)
202 var wg sync.WaitGroup
203 wg.Add(1)
204 go func() {
205 defer wg.Done()
206 buf, err := rconn.Reader().Next(size)
207 MustNil(t, err)
208 Equal(t, len(buf), size)
209 }()
210 time.Sleep(time.Millisecond)
211 syscall.Write(w, msg)
212 syscall.Close(w)
213 wg.Wait()
214}
215
216func TestConnectionWaitReadHalfPacket(t *testing.T) {
217 r, w := GetSysFdPairs()

Callers

nothing calls this directly

Calls 10

initMethod · 0.95
ReaderMethod · 0.95
GetSysFdPairsFunction · 0.85
AddMethod · 0.80
NextMethod · 0.65
CloseMethod · 0.65
WaitMethod · 0.65
MustNilFunction · 0.50
EqualFunction · 0.50
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…