Hi. On my system (Linux z.y 4.18.12-200.fc28.x86_64 #1 SMP Thu Oct 4 15:46:35 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux) the netspeeds component of slstatus doesn't work at all. I get some Pib results for my wireless network card and just 0 for my ethernet card. I don't exactly understand how and where slstatus handles calling this component twice, but from my debugging it is obvious it is called twice for every slstatus update. The issue seems to be that often, the read from the linux sys file yields 0, and this makes the result of this component incoherent. I really am not sure why this works, but with this patch I get reliable and seemingly correct results. If someone can explain me how this works, I would be very thankful. Regards John
diff --git a/components/netspeeds.c b/components/netspeeds.c index 02c030e..665dffd 100644 --- a/components/netspeeds.c +++ b/components/netspeeds.c @@ -28,6 +28,9 @@ if (oldrxbytes == 0) { return NULL; } + if (rxbytes == 0) { + rxbytes = oldrxbytes; + } return fmt_human((rxbytes - oldrxbytes) * 1000 / interval, 1024); @@ -54,6 +57,9 @@ if (oldtxbytes == 0) { return NULL; } + if (txbytes == 0) { + txbytes = oldtxbytes; + } return fmt_human((txbytes - oldtxbytes) * 1000 / interval, 1024);