...
1
2
3
4
5
6
7 package quic
8
9 import "fmt"
10
11
12
13
14
15
16
17
18
19
20
21
22 func (c *Conn) handleAckOrLoss(space numberSpace, sent *sentPacket, fate packetFate) {
23
24
25
26
27
28
29 for !sent.done() {
30 switch f := sent.next(); f {
31 default:
32 panic(fmt.Sprintf("BUG: unhandled acked/lost frame type %x", f))
33 case frameTypeAck:
34
35
36
37
38
39
40 largest := packetNumber(sent.nextInt())
41 if fate == packetAcked {
42 c.acks[space].handleAck(largest)
43 }
44 case frameTypeCrypto:
45 start, end := sent.nextRange()
46 c.crypto[space].ackOrLoss(start, end, fate)
47 case frameTypeMaxData:
48 c.ackOrLossMaxData(sent.num, fate)
49 case frameTypeResetStream,
50 frameTypeStopSending,
51 frameTypeMaxStreamData,
52 frameTypeStreamDataBlocked:
53 id := streamID(sent.nextInt())
54 s := c.streamForID(id)
55 if s == nil {
56 continue
57 }
58 s.ackOrLoss(sent.num, f, fate)
59 case frameTypeStreamBase,
60 frameTypeStreamBase | streamFinBit:
61 id := streamID(sent.nextInt())
62 start, end := sent.nextRange()
63 s := c.streamForID(id)
64 if s == nil {
65 continue
66 }
67 fin := f&streamFinBit != 0
68 s.ackOrLossData(sent.num, start, end, fin, fate)
69 case frameTypeMaxStreamsBidi:
70 c.streams.remoteLimit[bidiStream].sendMax.ackLatestOrLoss(sent.num, fate)
71 case frameTypeMaxStreamsUni:
72 c.streams.remoteLimit[uniStream].sendMax.ackLatestOrLoss(sent.num, fate)
73 case frameTypeNewConnectionID:
74 seq := int64(sent.nextInt())
75 c.connIDState.ackOrLossNewConnectionID(sent.num, seq, fate)
76 case frameTypeRetireConnectionID:
77 seq := int64(sent.nextInt())
78 c.connIDState.ackOrLossRetireConnectionID(sent.num, seq, fate)
79 case frameTypeHandshakeDone:
80 c.handshakeConfirmed.ackOrLoss(sent.num, fate)
81 }
82 }
83 }
84
View as plain text