use synctest to make the connection tests fully deterministic (#5317)

This commit is contained in:
Marten Seemann
2025-09-24 18:54:22 +08:00
committed by GitHub
parent 2ac3b16df4
commit 97f3aae776
2 changed files with 1234 additions and 1124 deletions

View File

@@ -670,7 +670,7 @@ runLoop:
} else {
idleTimeoutStartTime := c.idleTimeoutStartTime()
if (!c.handshakeComplete && now.Sub(idleTimeoutStartTime) >= c.config.HandshakeIdleTimeout) ||
(c.handshakeComplete && now.After(c.nextIdleTimeoutTime())) {
(c.handshakeComplete && !now.Before(c.nextIdleTimeoutTime())) {
c.destroyImpl(qerr.ErrIdleTimeout)
break runLoop
}
@@ -878,7 +878,7 @@ func (c *Conn) maybeResetTimer() {
func (c *Conn) idleTimeoutStartTime() monotime.Time {
startTime := c.lastPacketReceivedTime
if t := c.firstAckElicitingPacketAfterIdleSentTime; t.After(startTime) {
if t := c.firstAckElicitingPacketAfterIdleSentTime; !t.IsZero() && t.After(startTime) {
startTime = t
}
return startTime

File diff suppressed because it is too large Load Diff