forked from quic-go/quic-go
remove unneeded check for destination connection ID in the client
The packetHandlerMap routes packets to the client based on the destination connection ID, so we can be sure that packets that are handled in the client have the right connection ID.
This commit is contained in:
@@ -308,11 +308,6 @@ func (c *client) handlePacketImpl(p *receivedPacket) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// reject packets with the wrong connection ID
|
||||
if !p.hdr.DestConnectionID.Equal(c.srcConnID) {
|
||||
return fmt.Errorf("received a packet with an unexpected connection ID (%s, expected %s)", p.hdr.DestConnectionID, c.srcConnID)
|
||||
}
|
||||
|
||||
if p.hdr.Type == protocol.PacketTypeRetry {
|
||||
c.handleRetryPacket(p.hdr)
|
||||
return nil
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"time"
|
||||
@@ -735,18 +734,4 @@ var _ = Describe("Client", func() {
|
||||
Expect(cl.version).ToNot(BeZero())
|
||||
Expect(cl.GetVersion()).To(Equal(cl.version))
|
||||
})
|
||||
|
||||
It("ignores packets with the wrong destination connection ID", func() {
|
||||
cl.session = NewMockQuicSession(mockCtrl) // don't EXPECT any handlePacket calls
|
||||
connID2 := protocol.ConnectionID{8, 7, 6, 5, 4, 3, 2, 1}
|
||||
Expect(connID).ToNot(Equal(connID2))
|
||||
Expect(cl.handlePacketImpl(&receivedPacket{
|
||||
remoteAddr: addr,
|
||||
hdr: &wire.Header{
|
||||
DestConnectionID: connID2,
|
||||
SrcConnectionID: connID,
|
||||
Version: cl.version,
|
||||
},
|
||||
})).To(MatchError(fmt.Sprintf("received a packet with an unexpected connection ID (0x0807060504030201, expected %s)", connID)))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user