Stop counting a partly filled send vector as a failure

This commit is contained in:
flamingcow
2026-08-04 12:45:12 -07:00
parent 1f9b5ea62e
commit 06592cbc81
2 changed files with 14 additions and 21 deletions
+5 -9
View File
@@ -10,8 +10,7 @@ type txStats struct {
frames atomic.Uint64
bytes atomic.Uint64
errs atomic.Uint64
short atomic.Uint64
_ [32]byte
_ [40]byte
}
type txWorker struct {
@@ -62,13 +61,10 @@ func (w *txWorker) run(done *atomic.Bool) {
w.stats.bytes.Add(b)
seq += uint64(n)
}
if n < w.batch {
switch {
case n < 0 && err != unix.EINTR && err != unix.EAGAIN && err != unix.ENOBUFS:
w.stats.errs.Add(1)
default:
w.stats.short.Add(1)
}
// Taking fewer of the vector than offered is the ring's room, not a frame
// lost: the rest go on the next pass.
if n < 0 && err != unix.EINTR && err != unix.EAGAIN && err != unix.ENOBUFS {
w.stats.errs.Add(1)
}
}
}