Periodic commit

This commit is contained in:
NeilClack
2026-08-13 13:28:13 -05:00
parent bea9a86358
commit c35f928c85
4 changed files with 54 additions and 9 deletions
+30 -9
View File
@@ -83,10 +83,11 @@ struct WifiDevice::Impl {
);
if (r < 0) {
std::string err = "D-Bus call failed: ";
err += error.message ? error.message : strerror(-r);
radiantwave::logger::Logger::instance().warning("WiFi",
std::string("D-Bus call failed: ") +
(error.message ? error.message : strerror(-r)));
sd_bus_error_free(&error);
throw std::runtime_error(err);
return nullptr;
}
sd_bus_error_free(&error);
@@ -116,10 +117,16 @@ struct WifiDevice::Impl {
);
if (r < 0) {
std::string err = "D-Bus property get failed: ";
err += error.message ? error.message : strerror(-r);
// Transient D-Bus errors (e.g. a reply raced with a state change
// while NetworkManager churns the device during a failed auth)
// must never throw out of here — callers treat a null reply as
// "unknown", which keeps the UI and wait loops running.
radiantwave::logger::Logger::instance().warning("WiFi",
"D-Bus property get failed on " + std::string(path) + "." +
std::string(prop) + ": " +
(error.message ? error.message : strerror(-r)));
sd_bus_error_free(&error);
throw std::runtime_error(err);
return nullptr;
}
sd_bus_error_free(&error);
@@ -145,7 +152,11 @@ std::string WifiDevice::getInterfaceName() const {
"Interface",
"s"
);
if (!msg) {
return "";
}
const char* iface = nullptr;
sd_bus_message_read(msg, "s", &iface);
std::string result = iface ? iface : "";
@@ -162,7 +173,13 @@ uint32_t WifiDevice::getDeviceState() const {
"State",
"u"
);
if (!msg) {
// Unknown state keeps callers polling/falling back gracefully instead
// of aborting on a transient read failure.
return nm_device_state::Unknown;
}
uint32_t state = 0;
sd_bus_message_read(msg, "u", &state);
sd_bus_message_unref(msg);
@@ -328,7 +345,11 @@ AccessPointInfo WifiDevice::getActiveAccessPoint() const {
"ActiveAccessPoint",
"o"
);
if (!msg) {
return AccessPointInfo{}; // No active AP
}
const char* ap_path = nullptr;
sd_bus_message_read(msg, "o", &ap_path);
sd_bus_message_unref(msg);