make Listener a struct, not an interface

This commit is contained in:
Marten Seemann 2023-03-22 12:51:29 +13:00
parent 2a03c6cd79
commit 1b64b13750
16 changed files with 53 additions and 37 deletions

View file

@ -20,7 +20,7 @@ var _ = Describe("Stream Cancellations", func() {
const numStreams = 80
Context("canceling the read side", func() {
var server quic.Listener
var server *quic.Listener
// The server accepts a single connection, and then opens numStreams unidirectional streams.
// On each of these streams, it (tries to) write PRData.
@ -222,7 +222,7 @@ var _ = Describe("Stream Cancellations", func() {
})
Context("canceling the write side", func() {
runClient := func(server quic.Listener) int32 /* number of canceled streams */ {
runClient := func(server *quic.Listener) int32 /* number of canceled streams */ {
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),

View file

@ -34,7 +34,7 @@ func (c *connIDGenerator) ConnectionIDLen() int {
var _ = Describe("Connection ID lengths tests", func() {
randomConnIDLen := func() int { return 4 + int(mrand.Int31n(15)) }
runServer := func(conf *quic.Config) quic.Listener {
runServer := func(conf *quic.Config) *quic.Listener {
GinkgoWriter.Write([]byte(fmt.Sprintf("Using %d byte connection ID for the server\n", conf.ConnectionIDLength)))
ln, err := quic.ListenAddr("localhost:0", getTLSConfig(), conf)
Expect(err).ToNot(HaveOccurred())

View file

@ -14,7 +14,7 @@ import (
)
var _ = Describe("Stream deadline tests", func() {
setup := func() (quic.Listener, quic.Stream, quic.Stream) {
setup := func() (*quic.Listener, quic.Stream, quic.Stream) {
server, err := quic.ListenAddr("localhost:0", getTLSConfig(), getQuicConfig(nil))
Expect(err).ToNot(HaveOccurred())
strChan := make(chan quic.SendStream)

View file

@ -22,7 +22,7 @@ func randomDuration(min, max time.Duration) time.Duration {
var _ = Describe("Drop Tests", func() {
var (
proxy *quicproxy.QuicProxy
ln quic.Listener
ln *quic.Listener
)
startListenerAndProxy := func(dropCallback quicproxy.DropCallback) {

View file

@ -32,7 +32,7 @@ type applicationProtocol struct {
var _ = Describe("Handshake drop tests", func() {
var (
proxy *quicproxy.QuicProxy
ln quic.Listener
ln *quic.Listener
)
data := GeneratePRData(5000)

View file

@ -46,7 +46,7 @@ func (c *tokenStore) Pop(key string) *quic.ClientToken {
var _ = Describe("Handshake tests", func() {
var (
server quic.Listener
server *quic.Listener
serverConfig *quic.Config
acceptStopped chan struct{}
)
@ -221,7 +221,7 @@ var _ = Describe("Handshake tests", func() {
Context("rate limiting", func() {
var (
server quic.Listener
server *quic.Listener
pconn net.PacketConn
)

View file

@ -14,7 +14,7 @@ import (
)
var _ = Describe("Multiplexing", func() {
runServer := func(ln quic.Listener) {
runServer := func(ln *quic.Listener) {
go func() {
defer GinkgoRecover()
for {
@ -52,7 +52,7 @@ var _ = Describe("Multiplexing", func() {
}
Context("multiplexing clients on the same conn", func() {
getListener := func() quic.Listener {
getListener := func() *quic.Listener {
ln, err := quic.ListenAddr(
"localhost:0",
getTLSConfig(),

View file

@ -15,7 +15,7 @@ import (
)
var _ = Describe("non-zero RTT", func() {
runServer := func() quic.Listener {
runServer := func() *quic.Listener {
ln, err := quic.ListenAddr(
"localhost:0",
getTLSConfig(),

View file

@ -16,7 +16,7 @@ var _ = Describe("Bidirectional streams", func() {
const numStreams = 300
var (
server quic.Listener
server *quic.Listener
serverAddr string
)

View file

@ -377,7 +377,7 @@ var _ = Describe("Timeout tests", func() {
Context("faulty packet conns", func() {
const handshakeTimeout = time.Second / 2
runServer := func(ln quic.Listener) error {
runServer := func(ln *quic.Listener) error {
conn, err := ln.Accept(context.Background())
if err != nil {
return err

View file

@ -61,7 +61,7 @@ var _ = Describe("Handshake tests", func() {
quicClientConf := addTracers(protocol.PerspectiveClient, getQuicConfig(nil))
quicServerConf := addTracers(protocol.PerspectiveServer, getQuicConfig(nil))
serverChan := make(chan quic.Listener)
serverChan := make(chan *quic.Listener)
go func() {
defer GinkgoRecover()
ln, err := quic.ListenAddr("localhost:0", getTLSConfig(), quicServerConf)

View file

@ -18,7 +18,7 @@ var _ = Describe("Unidirectional Streams", func() {
const numStreams = 500
var (
server quic.Listener
server *quic.Listener
serverAddr string
)

View file

@ -45,7 +45,7 @@ func (t *versionNegotiationTracer) ReceivedVersionNegotiationPacket(dest, src lo
}
var _ = Describe("Handshake tests", func() {
startServer := func(tlsConf *tls.Config, conf *quic.Config) (quic.Listener, func()) {
startServer := func(tlsConf *tls.Config, conf *quic.Config) (*quic.Listener, func()) {
server, err := quic.ListenAddr("localhost:0", tlsConf, conf)
Expect(err).ToNot(HaveOccurred())