Skip to content

Commit

Permalink
ussd: Cancel pending requests when unregistering
Browse files Browse the repository at this point in the history
And reset state to idle before unregistering the D-Bus interface.
This may occur e.g. when we receive REFRESH from STK.
  • Loading branch information
monich committed May 23, 2018
1 parent 92a4760 commit 6f263ee
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ofono/src/ussd.c
Expand Up @@ -813,6 +813,22 @@ static void ussd_unregister(struct ofono_atom *atom)
DBusConnection *conn = ofono_dbus_get_connection();
struct ofono_modem *modem = __ofono_atom_get_modem(atom);
const char *path = __ofono_atom_get_path(atom);
DBusMessage *reply;

if (ussd->pending) {
reply = __ofono_error_canceled(ussd->pending);
__ofono_dbus_pending_reply(&ussd->pending, reply);
}

if (ussd->cancel) {
reply = dbus_message_new_method_return(ussd->cancel);
__ofono_dbus_pending_reply(&ussd->cancel, reply);
}

if (ussd->req)
ussd_request_finish(ussd, -ECANCELED, 0, NULL, 0);

ussd_change_state(ussd, USSD_STATE_IDLE);

g_slist_free_full(ussd->ss_control_list, ssc_entry_destroy);
ussd->ss_control_list = NULL;
Expand Down

0 comments on commit 6f263ee

Please sign in to comment.