forked from quic-go/quic-go
@@ -260,11 +260,11 @@ func (s *Session) handlePacketImpl(remoteAddr interface{}, hdr *publicHeader, da
|
||||
|
||||
err = s.receivedPacketHandler.ReceivedPacket(hdr.PacketNumber, packet.entropyBit)
|
||||
// ignore duplicate packets
|
||||
if err == ackhandlerlegacy.ErrDuplicatePacket {
|
||||
if err == ackhandlerlegacy.ErrDuplicatePacket || err == ackhandler.ErrDuplicatePacket {
|
||||
return nil
|
||||
}
|
||||
// ignore packets with packet numbers smaller than the LeastUnacked of a StopWaiting
|
||||
if err == ackhandlerlegacy.ErrPacketSmallerThanLastStopWaiting {
|
||||
if err == ackhandlerlegacy.ErrPacketSmallerThanLastStopWaiting || err == ackhandler.ErrPacketSmallerThanLastStopWaiting {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -305,6 +305,8 @@ func (s *Session) handleFrames(fs []frames.Frame) error {
|
||||
switch err {
|
||||
case ackhandlerlegacy.ErrDuplicateOrOutOfOrderAck:
|
||||
// Can happen e.g. when packets thought missing arrive late
|
||||
case ackhandler.ErrDuplicateOrOutOfOrderAck:
|
||||
// Can happen e.g. when packets thought missing arrive late
|
||||
case errRstStreamOnInvalidStream:
|
||||
// Can happen when RST_STREAMs arrive early or late (?)
|
||||
utils.Errorf("Ignoring error in session: %s", err.Error())
|
||||
|
||||
@@ -3,6 +3,7 @@ package quic
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"runtime"
|
||||
@@ -84,6 +85,9 @@ var _ = Describe("Session", func() {
|
||||
conn *mockConnection
|
||||
)
|
||||
|
||||
for _, version := range []protocol.VersionNumber{protocol.Version33, protocol.Version34} {
|
||||
Context(fmt.Sprintf("with quic version %d", version), func() {
|
||||
|
||||
BeforeEach(func() {
|
||||
conn = &mockConnection{}
|
||||
streamCallbackCalled = false
|
||||
@@ -97,7 +101,7 @@ var _ = Describe("Session", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
pSession, err := newSession(
|
||||
conn,
|
||||
0,
|
||||
version,
|
||||
0,
|
||||
scfg,
|
||||
func(*Session, utils.Stream) { streamCallbackCalled = true },
|
||||
@@ -429,15 +433,13 @@ var _ = Describe("Session", func() {
|
||||
|
||||
Context("sending packets", func() {
|
||||
It("sends ack frames", func() {
|
||||
packetNumber := protocol.PacketNumber(0x0135)
|
||||
var entropy ackhandlerlegacy.EntropyAccumulator
|
||||
packetNumber := protocol.PacketNumber(0x0135EA)
|
||||
session.receivedPacketHandler.ReceivedPacket(packetNumber, true)
|
||||
entropy.Add(packetNumber, true)
|
||||
err := session.sendPacket()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(conn.written).To(HaveLen(1))
|
||||
// test for the beginning of an ACK frame: Entropy until LargestObserved
|
||||
Expect(conn.written[0]).To(ContainSubstring(string([]byte{byte(entropy), 0x35, 0x01})))
|
||||
Expect(conn.written[0]).To(ContainSubstring(string([]byte{0xEA, 0x35, 0x01})))
|
||||
})
|
||||
|
||||
It("sends two WindowUpdate frames", func() {
|
||||
@@ -759,4 +761,6 @@ var _ = Describe("Session", func() {
|
||||
Expect(frames[0].ByteOffset).To(Equal(protocol.ReceiveConnectionFlowControlWindow * 2))
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user