net: Don't disable when linkspeed not detected (#1772)

Shows "N/A" instead.

Fixes #1211
This commit is contained in:
Hayden Sartoris 2019-09-27 11:01:45 -04:00 committed by Patrick Ziegler
parent 99e823bd0a
commit 3e83fb9fb2

View File

@ -270,10 +270,10 @@ namespace net {
request.ifr_data = reinterpret_cast<char*>(&data); request.ifr_data = reinterpret_cast<char*>(&data);
if (ioctl(*m_socketfd, SIOCETHTOOL, &request) == -1) { if (ioctl(*m_socketfd, SIOCETHTOOL, &request) == -1) {
return false; m_linkspeed = -1;
} } else {
m_linkspeed = data.speed; m_linkspeed = data.speed;
}
return true; return true;
} }
@ -306,7 +306,7 @@ namespace net {
* about the current connection * about the current connection
*/ */
string wired_network::linkspeed() const { string wired_network::linkspeed() const {
return (m_linkspeed == 0 ? "???" : to_string(m_linkspeed)) + " Mbit/s"; return m_linkspeed == -1 ? "N/A" : (to_string(m_linkspeed) + " Mbit/s");
} }
// }}} // }}}