only print the warning about the UDP receive buffer size once

This commit is contained in:
Marten Seemann
2020-12-02 15:42:29 +07:00
parent a76879c305
commit 0eb3f14a60
2 changed files with 23 additions and 14 deletions

View File

@@ -4,7 +4,10 @@ import (
"bytes"
"crypto/rand"
"errors"
"io/ioutil"
"log"
"net"
"os"
"time"
mocklogging "github.com/lucas-clemente/quic-go/internal/mocks/logging"
@@ -63,6 +66,7 @@ var _ = Describe("Packet Handler Map", func() {
})
JustBeforeEach(func() {
log.SetOutput(ioutil.Discard)
conn = NewMockPacketConn(mockCtrl)
conn.EXPECT().LocalAddr().Return(&net.UDPAddr{}).AnyTimes()
conn.EXPECT().ReadFrom(gomock.Any()).DoAndReturn(func(b []byte) (int, net.Addr, error) {
@@ -77,6 +81,8 @@ var _ = Describe("Packet Handler Map", func() {
handler = phm.(*packetHandlerMap)
})
AfterEach(func() { log.SetOutput(os.Stdout) })
It("closes", func() {
getMultiplexer() // make the sync.Once execute
// replace the clientMuxer. getClientMultiplexer will now return the MockMultiplexer