diff options
author | Mikel Astiz <mikel.astiz@bmw-carit.de> | 2012-06-12 14:10:26 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-06-12 17:29:34 +0300 |
commit | 2b59acfbd4635a058c96845aba3cc86fb8961b24 (patch) | |
tree | 8eaae392714c219a45427e8c12343b37b7a92e76 | |
parent | d2071191c0d787c6033e0fbafc0879866d7718e5 (diff) | |
download | obexd-2b59acfbd4635a058c96845aba3cc86fb8961b24.tar.gz |
client: Fix cancellation of queued transfers
Cancelling queued (not started yet) transfers should not fail. Instead,
they must be removed from the queue, so we just need to call the
transfer callback.
-rw-r--r-- | client/transfer.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/client/transfer.c b/client/transfer.c index f296638..cb7c26c 100644 --- a/client/transfer.c +++ b/client/transfer.c @@ -204,10 +204,20 @@ static DBusMessage *obc_transfer_cancel(DBusConnection *connection, ERROR_INTERFACE ".InProgress", "Cancellation already in progress"); - if (transfer->xfer == 0) - return g_dbus_create_error(message, - ERROR_INTERFACE ".Failed", - "Failed"); + if (transfer->xfer == 0) { + struct transfer_callback *callback = transfer->callback; + + if (callback != NULL) { + GError *err; + + err = g_error_new(OBC_TRANSFER_ERROR, -ECANCELED, "%s", + "Transfer cancelled by user"); + callback->func(transfer, err, callback->data); + g_error_free(err); + } + + return dbus_message_new_method_return(message); + } if (transfer->progress_id != 0) { g_source_remove(transfer->progress_id); |