mirror of git://git.sysmocom.de/ofono
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
This commit is contained in:
parent
90dadace21
commit
8e78d4dba5
|
@ -52,6 +52,7 @@ struct allowed_apns_ctx {
|
||||||
struct ofono_sim_context *sim_context;
|
struct ofono_sim_context *sim_context;
|
||||||
DBusMessage *pending;
|
DBusMessage *pending;
|
||||||
DBusMessage *reply;
|
DBusMessage *reply;
|
||||||
|
bool registered;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void context_destroy(gpointer data)
|
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();
|
DBusConnection *conn = ofono_dbus_get_connection();
|
||||||
|
|
||||||
if (new_state != OFONO_SIM_STATE_READY) {
|
if (new_state != OFONO_SIM_STATE_READY) {
|
||||||
|
if (!ctx->registered)
|
||||||
|
return;
|
||||||
|
|
||||||
g_dbus_unregister_interface(conn,
|
g_dbus_unregister_interface(conn,
|
||||||
ofono_modem_get_path(ctx->modem),
|
ofono_modem_get_path(ctx->modem),
|
||||||
ALLOWED_ACCESS_POINTS_INTERFACE);
|
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,
|
ofono_modem_remove_interface(ctx->modem,
|
||||||
ALLOWED_ACCESS_POINTS_INTERFACE);
|
ALLOWED_ACCESS_POINTS_INTERFACE);
|
||||||
|
|
||||||
|
ctx->registered = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +188,7 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->registered = true;
|
||||||
ofono_modem_add_interface(ctx->modem,
|
ofono_modem_add_interface(ctx->modem,
|
||||||
ALLOWED_ACCESS_POINTS_INTERFACE);
|
ALLOWED_ACCESS_POINTS_INTERFACE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue