fix interpretation of time.Time{} as a pacing deadline

The pacer returns the zero value of time.Time when a packet can be sent
immediately. The session uses the zero value to unset the pacing
deadline.
This commit is contained in:
Marten Seemann
2021-01-04 14:23:48 +08:00
parent 4653549266
commit 33d058f4ee
3 changed files with 29 additions and 5 deletions

View File

@@ -57,6 +57,7 @@ func (p *pacer) maxBurstSize() protocol.ByteCount {
}
// TimeUntilSend returns when the next packet should be sent.
// It returns the zero value of time.Time if a packet can be sent immediately.
func (p *pacer) TimeUntilSend() time.Time {
if p.budgetAtLastSent >= maxDatagramSize {
return time.Time{}