summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2020-02-07 11:06:32 -0600
committerDenis Kenzior <denkenz@gmail.com>2020-02-07 11:08:13 -0600
commit8e78d4dba5d54b4b1175a53973ceb6f829c22bfa (patch)
tree3f360d169c6f03b75b329760559fd468e23307fd /plugins
parent90dadace21f468b1d51e242f2fe05786590da386 (diff)
downloadofono-8e78d4dba5d54b4b1175a53973ceb6f829c22bfa.tar.gz
allowed-apns: Do not try to unregister unnecessarily
allowed-apns plugin will try to uregister the AllowedAccessPoints interface whenever the sim state changes, even when not registered. This results in the (benign) error being printed inside ofono_modem_remove_interface: Interface org.ofono.AllowedAccessPoints not found on the interface_list
Diffstat (limited to 'plugins')
-rw-r--r--plugins/allowed-apns.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/allowed-apns.c b/plugins/allowed-apns.c
index b222b91c..199202b5 100644
--- a/plugins/allowed-apns.c
+++ b/plugins/allowed-apns.c
@@ -52,6 +52,7 @@ struct allowed_apns_ctx {
struct ofono_sim_context *sim_context;
DBusMessage *pending;
DBusMessage *reply;
+ bool registered;
};
static void context_destroy(gpointer data)
@@ -162,6 +163,9 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *data)
DBusConnection *conn = ofono_dbus_get_connection();
if (new_state != OFONO_SIM_STATE_READY) {
+ if (!ctx->registered)
+ return;
+
g_dbus_unregister_interface(conn,
ofono_modem_get_path(ctx->modem),
ALLOWED_ACCESS_POINTS_INTERFACE);
@@ -169,6 +173,7 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *data)
ofono_modem_remove_interface(ctx->modem,
ALLOWED_ACCESS_POINTS_INTERFACE);
+ ctx->registered = false;
return;
}
@@ -183,6 +188,7 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *data)
return;
}
+ ctx->registered = true;
ofono_modem_add_interface(ctx->modem,
ALLOWED_ACCESS_POINTS_INTERFACE);
}