replace usages of session in variable names

This commit is contained in:
Marten Seemann 2022-03-26 15:05:35 +01:00
parent e71c236232
commit fda9f72161
23 changed files with 373 additions and 373 deletions

View file

@ -125,9 +125,9 @@ var _ = Describe("Timeout tests", func() {
go func() {
defer GinkgoRecover()
sess, err := server.Accept(context.Background())
conn, err := server.Accept(context.Background())
Expect(err).ToNot(HaveOccurred())
str, err := sess.OpenStream()
str, err := conn.OpenStream()
Expect(err).ToNot(HaveOccurred())
_, err = str.Write([]byte("foobar"))
Expect(err).ToNot(HaveOccurred())
@ -144,15 +144,15 @@ var _ = Describe("Timeout tests", func() {
Expect(err).ToNot(HaveOccurred())
defer proxy.Close()
sess, err := quic.DialAddr(
conn, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true, MaxIdleTimeout: idleTimeout}),
)
Expect(err).ToNot(HaveOccurred())
strIn, err := sess.AcceptStream(context.Background())
strIn, err := conn.AcceptStream(context.Background())
Expect(err).ToNot(HaveOccurred())
strOut, err := sess.OpenStream()
strOut, err := conn.OpenStream()
Expect(err).ToNot(HaveOccurred())
_, err = strIn.Read(make([]byte, 6))
Expect(err).ToNot(HaveOccurred())
@ -167,13 +167,13 @@ var _ = Describe("Timeout tests", func() {
checkTimeoutError(err)
_, err = strOut.Read([]byte{0})
checkTimeoutError(err)
_, err = sess.OpenStream()
_, err = conn.OpenStream()
checkTimeoutError(err)
_, err = sess.OpenUniStream()
_, err = conn.OpenUniStream()
checkTimeoutError(err)
_, err = sess.AcceptStream(context.Background())
_, err = conn.AcceptStream(context.Background())
checkTimeoutError(err)
_, err = sess.AcceptUniStream(context.Background())
_, err = conn.AcceptUniStream(context.Background())
checkTimeoutError(err)
})
@ -193,17 +193,17 @@ var _ = Describe("Timeout tests", func() {
Expect(err).ToNot(HaveOccurred())
defer server.Close()
serverSessionClosed := make(chan struct{})
serverConnClosed := make(chan struct{})
go func() {
defer GinkgoRecover()
sess, err := server.Accept(context.Background())
conn, err := server.Accept(context.Background())
Expect(err).ToNot(HaveOccurred())
sess.AcceptStream(context.Background()) // blocks until the session is closed
close(serverSessionClosed)
conn.AcceptStream(context.Background()) // blocks until the connection is closed
close(serverConnClosed)
}()
tr := newPacketTracer()
sess, err := quic.DialAddr(
conn, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
@ -216,7 +216,7 @@ var _ = Describe("Timeout tests", func() {
done := make(chan struct{})
go func() {
defer GinkgoRecover()
_, err := sess.AcceptStream(context.Background())
_, err := conn.AcceptStream(context.Background())
checkTimeoutError(err)
close(done)
}()
@ -244,11 +244,11 @@ var _ = Describe("Timeout tests", func() {
BeNumerically(">=", idleTimeout),
BeNumerically("<", idleTimeout*6/5),
))
Consistently(serverSessionClosed).ShouldNot(BeClosed())
Consistently(serverConnClosed).ShouldNot(BeClosed())
// make the go routine return
Expect(server.Close()).To(Succeed())
Eventually(serverSessionClosed).Should(BeClosed())
Eventually(serverConnClosed).Should(BeClosed())
})
It("times out after sending a packet", func() {
@ -273,16 +273,16 @@ var _ = Describe("Timeout tests", func() {
Expect(err).ToNot(HaveOccurred())
defer proxy.Close()
serverSessionClosed := make(chan struct{})
serverConnClosed := make(chan struct{})
go func() {
defer GinkgoRecover()
sess, err := server.Accept(context.Background())
conn, err := server.Accept(context.Background())
Expect(err).ToNot(HaveOccurred())
<-sess.Context().Done() // block until the session is closed
close(serverSessionClosed)
<-conn.Context().Done() // block until the connection is closed
close(serverConnClosed)
}()
sess, err := quic.DialAddr(
conn, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIdleTimeout: idleTimeout, DisablePathMTUDiscovery: true}),
@ -292,7 +292,7 @@ var _ = Describe("Timeout tests", func() {
// wait half the idle timeout, then send a packet
time.Sleep(idleTimeout / 2)
drop.Set(true)
str, err := sess.OpenUniStream()
str, err := conn.OpenUniStream()
Expect(err).ToNot(HaveOccurred())
_, err = str.Write([]byte("foobar"))
Expect(err).ToNot(HaveOccurred())
@ -302,7 +302,7 @@ var _ = Describe("Timeout tests", func() {
done := make(chan struct{})
go func() {
defer GinkgoRecover()
_, err := sess.AcceptStream(context.Background())
_, err := conn.AcceptStream(context.Background())
checkTimeoutError(err)
close(done)
}()
@ -312,11 +312,11 @@ var _ = Describe("Timeout tests", func() {
BeNumerically(">=", idleTimeout),
BeNumerically("<", idleTimeout*12/10),
))
Consistently(serverSessionClosed).ShouldNot(BeClosed())
Consistently(serverConnClosed).ShouldNot(BeClosed())
// make the go routine return
Expect(server.Close()).To(Succeed())
Eventually(serverSessionClosed).Should(BeClosed())
Eventually(serverConnClosed).Should(BeClosed())
})
})
@ -331,13 +331,13 @@ var _ = Describe("Timeout tests", func() {
Expect(err).ToNot(HaveOccurred())
defer server.Close()
serverSessionClosed := make(chan struct{})
serverConnClosed := make(chan struct{})
go func() {
defer GinkgoRecover()
sess, err := server.Accept(context.Background())
conn, err := server.Accept(context.Background())
Expect(err).ToNot(HaveOccurred())
sess.AcceptStream(context.Background()) // blocks until the session is closed
close(serverSessionClosed)
conn.AcceptStream(context.Background()) // blocks until the connection is closed
close(serverConnClosed)
}()
drop := utils.AtomicBool{}
@ -350,7 +350,7 @@ var _ = Describe("Timeout tests", func() {
Expect(err).ToNot(HaveOccurred())
defer proxy.Close()
sess, err := quic.DialAddr(
conn, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
@ -363,11 +363,11 @@ var _ = Describe("Timeout tests", func() {
// wait longer than the idle timeout
time.Sleep(3 * idleTimeout)
str, err := sess.OpenUniStream()
str, err := conn.OpenUniStream()
Expect(err).ToNot(HaveOccurred())
_, err = str.Write([]byte("foobar"))
Expect(err).ToNot(HaveOccurred())
Consistently(serverSessionClosed).ShouldNot(BeClosed())
Consistently(serverConnClosed).ShouldNot(BeClosed())
// idle timeout will still kick in if pings are dropped
drop.Set(true)
@ -376,7 +376,7 @@ var _ = Describe("Timeout tests", func() {
checkTimeoutError(err)
Expect(server.Close()).To(Succeed())
Eventually(serverSessionClosed).Should(BeClosed())
Eventually(serverConnClosed).Should(BeClosed())
})
Context("faulty packet conns", func() {
@ -391,11 +391,11 @@ var _ = Describe("Timeout tests", func() {
})
runServer := func(ln quic.Listener) error {
sess, err := ln.Accept(context.Background())
conn, err := ln.Accept(context.Background())
if err != nil {
return err
}
str, err := sess.OpenUniStream()
str, err := conn.OpenUniStream()
if err != nil {
return err
}
@ -404,8 +404,8 @@ var _ = Describe("Timeout tests", func() {
return err
}
runClient := func(sess quic.Connection) error {
str, err := sess.AcceptUniStream(context.Background())
runClient := func(conn quic.Connection) error {
str, err := conn.AcceptUniStream(context.Background())
if err != nil {
return err
}
@ -414,7 +414,7 @@ var _ = Describe("Timeout tests", func() {
return err
}
Expect(data).To(Equal(PRData))
return sess.CloseWithError(0, "done")
return conn.CloseWithError(0, "done")
}
It("deals with an erroring packet conn, on the server side", func() {
@ -440,7 +440,7 @@ var _ = Describe("Timeout tests", func() {
clientErrChan := make(chan error, 1)
go func() {
defer GinkgoRecover()
sess, err := quic.DialAddr(
conn, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
@ -453,7 +453,7 @@ var _ = Describe("Timeout tests", func() {
clientErrChan <- err
return
}
clientErrChan <- runClient(sess)
clientErrChan <- runClient(conn)
}()
var clientErr error
@ -501,7 +501,7 @@ var _ = Describe("Timeout tests", func() {
clientErrChan := make(chan error, 1)
go func() {
defer GinkgoRecover()
sess, err := quic.Dial(
conn, err := quic.Dial(
&faultyConn{PacketConn: conn, MaxPackets: maxPackets},
ln.Addr(),
"localhost",
@ -512,7 +512,7 @@ var _ = Describe("Timeout tests", func() {
clientErrChan <- err
return
}
clientErrChan <- runClient(sess)
clientErrChan <- runClient(conn)
}()
var clientErr error