MCPcopy
hub / github.com/golang/net / testConnOutflowMaxDataRoundRobin

Function testConnOutflowMaxDataRoundRobin

quic/conn_flow_test.go:364–414  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

362 synctest.Test(t, testConnOutflowMaxDataRoundRobin)
363}
364func testConnOutflowMaxDataRoundRobin(t *testing.T) {
365 ctx := canceledContext()
366 tc := newTestConn(t, clientSide, permissiveTransportParameters,
367 func(p *transportParameters) {
368 p.initialMaxData = 0
369 })
370 tc.handshake()
371 tc.ignoreFrame(frameTypeAck)
372
373 s1, err := tc.conn.newLocalStream(ctx, uniStream)
374 if err != nil {
375 t.Fatalf("conn.newLocalStream(%v) = %v", uniStream, err)
376 }
377 s2, err := tc.conn.newLocalStream(ctx, uniStream)
378 if err != nil {
379 t.Fatalf("conn.newLocalStream(%v) = %v", uniStream, err)
380 }
381
382 s1.Write(make([]byte, 10))
383 s1.Flush()
384 s2.Write(make([]byte, 10))
385 s2.Flush()
386
387 tc.writeFrames(packetType1RTT, debugFrameMaxData{
388 max: 1,
389 })
390 tc.wantFrame("stream 1 writes data up to MAX_DATA limit",
391 packetType1RTT, debugFrameStream{
392 id: s1.id,
393 data: []byte{0},
394 })
395
396 tc.writeFrames(packetType1RTT, debugFrameMaxData{
397 max: 2,
398 })
399 tc.wantFrame("stream 2 writes data up to MAX_DATA limit",
400 packetType1RTT, debugFrameStream{
401 id: s2.id,
402 data: []byte{0},
403 })
404
405 tc.writeFrames(packetType1RTT, debugFrameMaxData{
406 max: 3,
407 })
408 tc.wantFrame("stream 1 writes data up to MAX_DATA limit",
409 packetType1RTT, debugFrameStream{
410 id: s1.id,
411 off: 1,
412 data: []byte{0},
413 })
414}
415
416func TestConnOutflowMetaAndData(t *testing.T) {
417 synctest.Test(t, testConnOutflowMetaAndData)

Callers

nothing calls this directly

Calls 9

canceledContextFunction · 0.85
newTestConnFunction · 0.85
handshakeMethod · 0.80
ignoreFrameMethod · 0.80
newLocalStreamMethod · 0.80
writeFramesMethod · 0.80
wantFrameMethod · 0.80
WriteMethod · 0.65
FlushMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…