diff options
author | Mikel Astiz <mikel.astiz@bmw-carit.de> | 2012-06-12 14:10:25 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-12-04 22:49:02 +0100 |
commit | 60b2e582097591547728e7c81d20460dd41c1466 (patch) | |
tree | 9fd55298ec9f06bf3c66f360a20be8760ee7f09a /obexd/client/transfer.c | |
parent | 68b394a78bfe0810c42fcc34934ca8d9fcbe1012 (diff) | |
download | bluez-60b2e582097591547728e7c81d20460dd41c1466.tar.gz |
obexd: Remove obc_transfer_abort
Refactor the code to remove function obc_transfer_abort, which is used
only once and is anyway coupled to the D-Bus API.
Diffstat (limited to 'obexd/client/transfer.c')
-rw-r--r-- | obexd/client/transfer.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c index 0686afec6..f296638c5 100644 --- a/obexd/client/transfer.c +++ b/obexd/client/transfer.c @@ -187,20 +187,6 @@ static void abort_complete(GObex *obex, GError *err, gpointer user_data) } } -static gboolean obc_transfer_abort(struct obc_transfer *transfer) -{ - if (transfer->xfer == 0) - return FALSE; - - if (transfer->progress_id != 0) { - g_source_remove(transfer->progress_id); - transfer->progress_id = 0; - } - - return g_obex_cancel_transfer(transfer->xfer, abort_complete, - transfer); -} - static DBusMessage *obc_transfer_cancel(DBusConnection *connection, DBusMessage *message, void *user_data) { @@ -218,7 +204,17 @@ static DBusMessage *obc_transfer_cancel(DBusConnection *connection, ERROR_INTERFACE ".InProgress", "Cancellation already in progress"); - if (!obc_transfer_abort(transfer)) + if (transfer->xfer == 0) + return g_dbus_create_error(message, + ERROR_INTERFACE ".Failed", + "Failed"); + + if (transfer->progress_id != 0) { + g_source_remove(transfer->progress_id); + transfer->progress_id = 0; + } + + if (!g_obex_cancel_transfer(transfer->xfer, abort_complete, transfer)) return g_dbus_create_error(message, ERROR_INTERFACE ".Failed", "Failed"); |