change public header to correctly state 48bit packet numbers

This commit is contained in:
Lucas Clemente 2016-04-21 17:02:15 +02:00
parent f513a702fa
commit b17d9a7e55
3 changed files with 4 additions and 4 deletions

View file

@ -22,7 +22,7 @@ type PublicHeader struct {
// WritePublicHeader writes a public header
func (h *PublicHeader) WritePublicHeader(b *bytes.Buffer) error {
publicFlagByte := uint8(0x0C | 0x20)
publicFlagByte := uint8(0x3c)
if h.VersionFlag && h.ResetFlag {
return errors.New("Reset Flag and Version Flag should not be set at the same time")
}

View file

@ -79,7 +79,7 @@ var _ = Describe("Public Header", func() {
PacketNumber: 2,
}
publicHeader.WritePublicHeader(b)
Expect(b.Bytes()).To(Equal([]byte{0x2c, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 2, 0, 0, 0, 0, 0}))
Expect(b.Bytes()).To(Equal([]byte{0x3c, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 2, 0, 0, 0, 0, 0}))
})
It("sets the Version Flag", func() {

View file

@ -43,7 +43,7 @@ var _ = Describe("Server", func() {
It("composes version negotiation packets", func() {
expected := append(
[]byte{0x2d, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0},
[]byte{0x3d, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0},
protocol.SupportedVersionsAsTags...,
)
Expect(composeVersionNegotiation(1)).To(Equal(expected))
@ -85,7 +85,7 @@ var _ = Describe("Server", func() {
Expect(err2).ToNot(HaveOccurred())
data = data[:n]
expected := append(
[]byte{0x2d, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0},
[]byte{0x3d, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0},
protocol.SupportedVersionsAsTags...,
)
Expect(data).To(Equal(expected))