forked from quic-go/quic-go
make sure RunHandshake has returned before closing, improve MITM tests
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
package self_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
mrand "math/rand"
|
||||
"net"
|
||||
"runtime/pprof"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
@@ -45,12 +42,6 @@ func (c *faultyConn) WriteTo(p []byte, addr net.Addr) (int, error) {
|
||||
return 0, io.ErrClosedPipe
|
||||
}
|
||||
|
||||
func areHandshakesRunning() bool {
|
||||
var b bytes.Buffer
|
||||
pprof.Lookup("goroutine").WriteTo(&b, 1)
|
||||
return strings.Contains(b.String(), "RunHandshake")
|
||||
}
|
||||
|
||||
var _ = Describe("Timeout tests", func() {
|
||||
checkTimeoutError := func(err error) {
|
||||
ExpectWithOffset(1, err).To(MatchError(&quic.IdleTimeoutError{}))
|
||||
@@ -382,14 +373,6 @@ var _ = Describe("Timeout tests", func() {
|
||||
Context("faulty packet conns", func() {
|
||||
const handshakeTimeout = time.Second / 2
|
||||
|
||||
BeforeEach(func() {
|
||||
Expect(areHandshakesRunning()).To(BeFalse())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
Expect(areHandshakesRunning()).To(BeFalse())
|
||||
})
|
||||
|
||||
runServer := func(ln quic.Listener) error {
|
||||
conn, err := ln.Accept(context.Background())
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user