When timeout no longer needs to be enforced, no need to schedule a broadcast.

This commit is contained in:
notsure2 2020-12-07 14:22:39 +02:00
parent ee5968afee
commit 3d103e728c
2 changed files with 2 additions and 2 deletions

View File

@ -105,7 +105,7 @@ func (d *datagramBufferedPipe) WriteTo(w io.Writer) (n int64, err error) {
if !d.rDeadline.IsZero() { if !d.rDeadline.IsZero() {
d.broadcastAfter(time.Until(d.rDeadline)) d.broadcastAfter(time.Until(d.rDeadline))
} }
} else { } else if enforceTimeout {
d.broadcastAfter(d.wtTimeout) d.broadcastAfter(d.wtTimeout)
} }

View File

@ -95,7 +95,7 @@ func (p *streamBufferedPipe) WriteTo(w io.Writer) (n int64, err error) {
if !p.rDeadline.IsZero() { if !p.rDeadline.IsZero() {
p.broadcastAfter(time.Until(p.rDeadline)) p.broadcastAfter(time.Until(p.rDeadline))
} }
} else { } else if enforceTimeout {
p.broadcastAfter(p.wtTimeout) p.broadcastAfter(p.wtTimeout)
} }