pass around receivedPacket as struct instead of as pointer (#3823)

This commit is contained in:
Marten Seemann 2023-06-03 10:08:58 +03:00 committed by GitHub
parent 591ab1ab5e
commit 072a602cc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 96 additions and 94 deletions

View file

@ -129,7 +129,7 @@ var _ = Describe("Packet Handler Map", func() {
Expect(ok).To(BeTrue())
Expect(h).ToNot(Equal(handler))
addr := &net.UDPAddr{IP: net.IPv4(1, 2, 3, 4), Port: 1234}
h.handlePacket(&receivedPacket{remoteAddr: addr})
h.handlePacket(receivedPacket{remoteAddr: addr})
Expect(closePackets).To(HaveLen(1))
Expect(closePackets[0].addr).To(Equal(addr))
Expect(closePackets[0].payload).To(Equal([]byte("foobar")))
@ -152,7 +152,7 @@ var _ = Describe("Packet Handler Map", func() {
Expect(ok).To(BeTrue())
Expect(h).ToNot(Equal(handler))
addr := &net.UDPAddr{IP: net.IPv4(1, 2, 3, 4), Port: 1234}
h.handlePacket(&receivedPacket{remoteAddr: addr})
h.handlePacket(receivedPacket{remoteAddr: addr})
Expect(closePackets).To(BeEmpty())
time.Sleep(dur)