Make every failed check and unreadable counter fatal instead of degrading

This commit is contained in:
flamingcow
2026-08-04 13:03:07 -07:00
parent fb6a0d2c1b
commit 66bfb88dd7
3 changed files with 16 additions and 9 deletions
+2 -2
View File
@@ -25,7 +25,7 @@ func setBufForce(fd, forceOpt, opt, size int) error {
func sockBufSize(fd, opt int) int {
v, err := unix.GetsockoptInt(fd, unix.SOL_SOCKET, opt)
if err != nil {
return -1
panic(fmt.Sprintf("reading socket buffer size: %v", err))
}
return v
}
@@ -117,7 +117,7 @@ func newMmsghdrs(bufs [][]byte) ([]mmsghdr, []unix.Iovec) {
func packetDrops(fd int) uint64 {
st, err := unix.GetsockoptTpacketStats(fd, unix.SOL_PACKET, unix.PACKET_STATISTICS)
if err != nil {
return 0
panic(fmt.Sprintf("reading packet drop statistics: %v", err))
}
return uint64(st.Drops)
}