returnfmt.Errorf("Received ACK with encryption level %s that acks a packet %d (encryption level %s)",encLevel,p.PacketNumber,p.EncryptionLevel)
returnfmt.Errorf("Received ACK with encryption level %s that acks a packet %d (encryption level %s)",encLevel,p.Value.PacketNumber,p.Value.EncryptionLevel)
}
}
// largestAcked == 0 either means that the packet didn't contain an ACK, or it just acked packet 0
// largestAcked == 0 either means that the packet didn't contain an ACK, or it just acked packet 0
// It is safe to ignore the corner case of packets that just acked packet 0, because
// It is safe to ignore the corner case of packets that just acked packet 0, because
// the lowestPacketNotConfirmedAcked is only used to limit the number of ACK ranges we will send.
// the lowestPacketNotConfirmedAcked is only used to limit the number of ACK ranges we will send.
ifpacketNumber>=ackRange.First{// packet i contained in ACK range
ifp.PacketNumber>=ackRange.First{// packet i contained in ACK range
ifpacketNumber>ackRange.Last{
ifp.PacketNumber>ackRange.Last{
returnnil,fmt.Errorf("BUG: ackhandler would have acked wrong packet 0x%x, while evaluating range 0x%x -> 0x%x",packetNumber,ackRange.First,ackRange.Last)
returnfalse,fmt.Errorf("BUG: ackhandler would have acked wrong packet 0x%x, while evaluating range 0x%x -> 0x%x",p.PacketNumber,ackRange.First,ackRange.Last)
// WindowUpdateThreshold is the fraction of the receive window that has to be consumed before an higher offset is advertised to the client
// WindowUpdateThreshold is the fraction of the receive window that has to be consumed before an higher offset is advertised to the client
constWindowUpdateThreshold=0.25
constWindowUpdateThreshold=0.25
// MaxIncomingStreams is the maximum number of streams that a peer may open
// DefaultMaxIncomingStreams is the maximum number of streams that a peer may open
constMaxIncomingStreams=100
constDefaultMaxIncomingStreams=100
// DefaultMaxIncomingUniStreams is the maximum number of unidirectional streams that a peer may open
constDefaultMaxIncomingUniStreams=100
// MaxStreamsMultiplier is the slack the client is allowed for the maximum number of streams per connection, needed e.g. when packets are out of order or dropped. The minimum of this procentual increase and the absolute increment specified by MaxStreamsMinimumIncrement is used.
// MaxStreamsMultiplier is the slack the client is allowed for the maximum number of streams per connection, needed e.g. when packets are out of order or dropped. The minimum of this procentual increase and the absolute increment specified by MaxStreamsMinimumIncrement is used.
// MaxStreamsMinimumIncrement is the slack the client is allowed for the maximum number of streams per connection, needed e.g. when packets are out of order or dropped. The minimum of this absolute increment and the procentual increase specified by MaxStreamsMultiplier is used.
// MaxStreamsMinimumIncrement is the slack the client is allowed for the maximum number of streams per connection, needed e.g. when packets are out of order or dropped. The minimum of this absolute increment and the procentual increase specified by MaxStreamsMultiplier is used.
constMaxStreamsMinimumIncrement=10
constMaxStreamsMinimumIncrement=10
// MaxNewStreamIDDelta is the maximum difference between and a newly opened Stream and the highest StreamID that a client has ever opened
// note that the number of streams is half this value, since the client can only open streams with open StreamID
constMaxNewStreamIDDelta=4*MaxIncomingStreams
// MaxSessionUnprocessedPackets is the max number of packets stored in each session that are not yet processed.
// MaxSessionUnprocessedPackets is the max number of packets stored in each session that are not yet processed.
returnnil,qerr.Error(qerr.InvalidStreamID,fmt.Sprintf("attempted to open stream %d, which is a lot smaller than the highest opened stream, %d",id,m.highestStreamOpenedByPeer))
returnnil,qerr.Error(qerr.InvalidStreamID,fmt.Sprintf("attempted to open stream %d, which is a lot smaller than the highest opened stream, %d",id,m.highestStreamOpenedByPeer))