summaryrefslogtreecommitdiffstats
path: root/src/ussd.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-08-16 11:02:05 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-08-16 11:02:05 -0500
commitcc67a2955193aa367065b95ed1f0eeb192b3c890 (patch)
treed4d4f4bd87a3e3d559912e7c5a8434b66702c436 /src/ussd.c
parent3791f4418a3155d5be98dd70b90a862e1f41cafe (diff)
downloadofono-cc67a2955193aa367065b95ed1f0eeb192b3c890.tar.bz2
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.
Diffstat (limited to 'src/ussd.c')
-rw-r--r--src/ussd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ussd.c b/src/ussd.c
index a2d6cf3b..825d5606 100644
--- a/src/ussd.c
+++ b/src/ussd.c
@@ -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);