@@ -15,7 +15,9 @@ import (
15
15
16
16
quic "github.com/lucas-clemente/quic-go"
17
17
quicproxy "github.com/lucas-clemente/quic-go/integrationtests/tools/proxy"
18
+ "github.com/lucas-clemente/quic-go/internal/protocol"
18
19
"github.com/lucas-clemente/quic-go/internal/utils"
20
+ "github.com/lucas-clemente/quic-go/logging"
19
21
. "github.com/onsi/ginkgo"
20
22
. "github.com/onsi/gomega"
21
23
)
@@ -44,6 +46,17 @@ func (c *faultyConn) WriteTo(p []byte, addr net.Addr) (int, error) {
44
46
return 0 , io .ErrClosedPipe
45
47
}
46
48
49
+ type handshakeCompleteTracer struct {
50
+ connTracer
51
+ completionTime time.Time
52
+ }
53
+
54
+ func (t * handshakeCompleteTracer ) DroppedEncryptionLevel (l protocol.EncryptionLevel ) {
55
+ if l == protocol .EncryptionHandshake {
56
+ t .completionTime = time .Now ()
57
+ }
58
+ }
59
+
47
60
func areHandshakesRunning () bool {
48
61
var b bytes.Buffer
49
62
pprof .Lookup ("goroutine" ).WriteTo (& b , 1 )
@@ -201,13 +214,13 @@ var _ = Describe("Timeout tests", func() {
201
214
close (serverSessionClosed )
202
215
}()
203
216
217
+ tr := & handshakeCompleteTracer {}
204
218
sess , err := quic .DialAddr (
205
219
fmt .Sprintf ("localhost:%d" , server .Addr ().(* net.UDPAddr ).Port ),
206
220
getTLSClientConfig (),
207
- getQuicConfig (& quic.Config {MaxIdleTimeout : idleTimeout }),
221
+ getQuicConfig (& quic.Config {MaxIdleTimeout : idleTimeout , Tracer : newTracer ( func () logging. ConnectionTracer { return tr }) }),
208
222
)
209
223
Expect (err ).ToNot (HaveOccurred ())
210
- startTime := time .Now ()
211
224
done := make (chan struct {})
212
225
go func () {
213
226
defer GinkgoRecover ()
@@ -216,7 +229,8 @@ var _ = Describe("Timeout tests", func() {
216
229
close (done )
217
230
}()
218
231
Eventually (done , 2 * idleTimeout ).Should (BeClosed ())
219
- dur := time .Since (startTime )
232
+ Expect (tr .completionTime ).ToNot (BeZero ())
233
+ dur := time .Since (tr .completionTime )
220
234
Expect (dur ).To (And (
221
235
BeNumerically (">=" , idleTimeout ),
222
236
BeNumerically ("<" , idleTimeout * 6 / 5 ),
0 commit comments