pass around the stateless reset token directly, not pointers to it

Benchmarks show that it's actually faster to make a copy of this 16 byte
array than passing around a pointer to it.
This commit is contained in:
Marten Seemann 2020-07-10 11:21:12 +07:00
parent 1f676c2a6c
commit 0ef1b2f92e
7 changed files with 22 additions and 24 deletions

View file

@ -247,7 +247,7 @@ var _ = Describe("Packet Handler Map", func() {
var resetErr statelessResetErr
Expect(errors.As(err, &resetErr)).To(BeTrue())
Expect(err.Error()).To(ContainSubstring("received a stateless reset"))
Expect(resetErr.token).To(Equal(&token))
Expect(resetErr.token).To(Equal(token))
close(destroyed)
})
conn.dataToRead <- packet
@ -268,7 +268,7 @@ var _ = Describe("Packet Handler Map", func() {
var resetErr statelessResetErr
Expect(errors.As(err, &resetErr)).To(BeTrue())
Expect(err.Error()).To(ContainSubstring("received a stateless reset"))
Expect(resetErr.token).To(Equal(&token))
Expect(resetErr.token).To(Equal(token))
close(destroyed)
})
conn.dataToRead <- packet