forked from quic-go/quic-go
fix typo in UDP connection helper function in tests (#4970)
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
||||
|
||||
func TestConnectionCloseRetransmission(t *testing.T) {
|
||||
server, err := quic.Listen(
|
||||
newUPDConnLocalhost(t),
|
||||
newUDPConnLocalhost(t),
|
||||
getTLSConfig(),
|
||||
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true}),
|
||||
)
|
||||
@@ -28,7 +28,7 @@ func TestConnectionCloseRetransmission(t *testing.T) {
|
||||
var drop atomic.Bool
|
||||
dropped := make(chan []byte, 100)
|
||||
proxy := &quicproxy.Proxy{
|
||||
Conn: newUPDConnLocalhost(t),
|
||||
Conn: newUDPConnLocalhost(t),
|
||||
ServerAddr: server.Addr().(*net.UDPAddr),
|
||||
DelayPacket: func(quicproxy.Direction, net.Addr, net.Addr, []byte) time.Duration {
|
||||
return 5 * time.Millisecond // 10ms RTT
|
||||
@@ -46,7 +46,7 @@ func TestConnectionCloseRetransmission(t *testing.T) {
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||
defer cancel()
|
||||
conn, err := quic.Dial(ctx, newUPDConnLocalhost(t), proxy.LocalAddr(), getTLSClientConfig(), getQuicConfig(nil))
|
||||
conn, err := quic.Dial(ctx, newUDPConnLocalhost(t), proxy.LocalAddr(), getTLSClientConfig(), getQuicConfig(nil))
|
||||
require.NoError(t, err)
|
||||
defer conn.CloseWithError(0, "")
|
||||
|
||||
@@ -84,11 +84,11 @@ func TestConnectionCloseRetransmission(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDrainServerAcceptQueue(t *testing.T) {
|
||||
server, err := quic.Listen(newUPDConnLocalhost(t), getTLSConfig(), getQuicConfig(nil))
|
||||
server, err := quic.Listen(newUDPConnLocalhost(t), getTLSConfig(), getQuicConfig(nil))
|
||||
require.NoError(t, err)
|
||||
defer server.Close()
|
||||
|
||||
dialer := &quic.Transport{Conn: newUPDConnLocalhost(t)}
|
||||
dialer := &quic.Transport{Conn: newUDPConnLocalhost(t)}
|
||||
defer dialer.Close()
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||
@@ -158,21 +158,21 @@ func (c *brokenConn) Break(e error) {
|
||||
|
||||
func TestTransportClose(t *testing.T) {
|
||||
t.Run("Close", func(t *testing.T) {
|
||||
conn := newUPDConnLocalhost(t)
|
||||
conn := newUDPConnLocalhost(t)
|
||||
testTransportClose(t, conn, func() { conn.Close() }, nil)
|
||||
})
|
||||
|
||||
t.Run("connection error", func(t *testing.T) {
|
||||
t.Setenv("QUIC_GO_DISABLE_RECEIVE_BUFFER_WARNING", "true")
|
||||
|
||||
bc := newBrokenConn(newUPDConnLocalhost(t))
|
||||
bc := newBrokenConn(newUDPConnLocalhost(t))
|
||||
testErr := errors.New("test error")
|
||||
testTransportClose(t, bc, func() { bc.Break(testErr) }, testErr)
|
||||
})
|
||||
}
|
||||
|
||||
func testTransportClose(t *testing.T, conn net.PacketConn, closeFn func(), expectedErr error) {
|
||||
server := newUPDConnLocalhost(t)
|
||||
server := newUDPConnLocalhost(t)
|
||||
tr := &quic.Transport{Conn: conn}
|
||||
|
||||
errChan := make(chan error, 1)
|
||||
|
||||
Reference in New Issue
Block a user