优化连接相关代码

This commit is contained in:
GoEdgeLab
2023-01-05 11:13:35 +08:00
parent 0596fb5328
commit e9ec45db04
2 changed files with 8 additions and 4 deletions

View File

@@ -222,7 +222,11 @@ func (this *ClientConn) SetReadDeadline(t time.Time) error {
return nil
}
this.readDeadlineTime = unixTime
if -time.Since(t) < HTTPIdleTimeout-1*time.Second {
var seconds = -time.Since(t)
if seconds <= 0 || seconds > HTTPIdleTimeout {
return nil
}
if seconds < HTTPIdleTimeout-1*time.Second {
this.isShortReading = true
}
}