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:
Marten Seemann
2018-11-27 13:35:03 +07:00
parent 5e01c49fdf
commit 38548c137c
2 changed files with 0 additions and 20 deletions

View File

@@ -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

View File

@@ -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)))
})
})