ussd: Be extra pedantic trying to Cancel

If we initiated a Respond() transaction, but have not returned from the
callback.  Or if we already called Cancel and it hasn't returned yet.
This commit is contained in:
Denis Kenzior 2010-08-16 11:02:05 -05:00
parent 3791f4418a
commit cc67a29551
1 changed files with 7 additions and 0 deletions

View File

@ -554,6 +554,13 @@ static DBusMessage *ussd_cancel(DBusConnection *conn, DBusMessage *msg,
if (ussd->state == USSD_STATE_IDLE)
return __ofono_error_not_active(msg);
/* We have called Respond() but not returned from its callback yet */
if (ussd->state == USSD_STATE_USER_ACTION && ussd->pending)
return __ofono_error_busy(msg);
if (ussd->cancel)
return __ofono_error_busy(msg);
if (!ussd->driver->cancel)
return __ofono_error_not_implemented(msg);