From 07805265946c154aefe6726f3a049de09ff8dd2f Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Thu, 1 May 2025 15:56:48 +0900 Subject: [PATCH] base-bearer: set dbus disconnect_request on ignored disconnection When we get a disconnect event that we wanted to ignore, set the DisconnectRequest property instead so clients on dbus can act on it. Also upgrade the logs from dbg to msg (info) as there would be otherwise no message indicating the disconnect request if it is not acted on. This was checked with dbus-monitor: ``` $ dbus-monitor --system "type='signal',sender='org.freedesktop.ModemManager1'" signal time=1747362238.227804 sender=:1.73798 -> destination=(null destination) serial=741 path=/org/freedesktop/ModemManager1/Bearer/0; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged string "org.freedesktop.ModemManager1.Bearer" array [ dict entry( string "DisconnectRequest" variant boolean true ) ] array [ ] ``` Signed-off-by: Dominique Martinet --- src/mm-base-bearer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mm-base-bearer.c b/src/mm-base-bearer.c index f45a1ebe..f9b86884 100644 --- a/src/mm-base-bearer.c +++ b/src/mm-base-bearer.c @@ -500,6 +500,7 @@ bearer_reset_interface_status (MMBaseBearer *self) mm_gdbus_bearer_set_profile_id (MM_GDBUS_BEARER (self), MM_3GPP_PROFILE_ID_UNKNOWN); mm_gdbus_bearer_set_multiplexed (MM_GDBUS_BEARER (self), FALSE); mm_gdbus_bearer_set_connected (MM_GDBUS_BEARER (self), FALSE); + mm_gdbus_bearer_set_disconnect_request (MM_GDBUS_BEARER (self), FALSE); mm_gdbus_bearer_set_suspended (MM_GDBUS_BEARER (self), FALSE); mm_gdbus_bearer_set_interface (MM_GDBUS_BEARER (self), NULL); mm_gdbus_bearer_set_ip4_config ( @@ -1491,13 +1492,14 @@ mm_base_bearer_disconnect_force (MMBaseBearer *self) return; if (self->priv->ignore_disconnection_reports) { - mm_obj_dbg (self, "disconnection should be forced but it's explicitly ignored"); + mm_obj_msg (self, "disconnection should be forced, but we can't. Request disconnection instead."); + mm_gdbus_bearer_set_disconnect_request (MM_GDBUS_BEARER(self), TRUE); bearer_run_dispatcher_scripts (self, MM_DISPATCHER_CONNECTION_EVENT_DISCONNECT_REQUEST); return; } - mm_obj_dbg (self, "forcing disconnection"); + mm_obj_msg (self, "forcing disconnection"); /* If currently connecting, try to cancel that operation. */ if (self->priv->status == MM_BEARER_STATUS_CONNECTING) {