parse the packet header before getting the session from the session map

This commit is contained in:
Marten Seemann 2017-11-09 20:52:52 +07:00
parent dd722758af
commit 5d4174b2f0
8 changed files with 144 additions and 173 deletions

View file

@ -422,7 +422,7 @@ var _ = Describe("Server", func() {
Eventually(func() int { return conn.dataWritten.Len() }).ShouldNot(BeZero())
Expect(conn.dataWrittenTo).To(Equal(udpAddr))
r := bytes.NewReader(conn.dataWritten.Bytes())
packet, err := wire.ParseHeader(r, protocol.PerspectiveServer, protocol.VersionUnknown)
packet, err := wire.ParseHeaderSentByServer(r, protocol.VersionUnknown)
Expect(err).ToNot(HaveOccurred())
Expect(packet.VersionFlag).To(BeTrue())
Expect(packet.ConnectionID).To(Equal(protocol.ConnectionID(0x1337)))
@ -455,7 +455,7 @@ var _ = Describe("Server", func() {
Eventually(func() int { return conn.dataWritten.Len() }).ShouldNot(BeZero())
Expect(conn.dataWrittenTo).To(Equal(udpAddr))
r := bytes.NewReader(conn.dataWritten.Bytes())
packet, err := wire.ParseHeader(r, protocol.PerspectiveServer, protocol.VersionUnknown)
packet, err := wire.ParseHeaderSentByServer(r, protocol.VersionUnknown)
Expect(err).ToNot(HaveOccurred())
Expect(packet.Type).To(Equal(protocol.PacketTypeVersionNegotiation))
Expect(packet.ConnectionID).To(Equal(protocol.ConnectionID(0x1337)))