[PATCH] Fix process pending request if transfer canceled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Please review.

/Daniel
From 7a0bd706951aebf7d66bd63f14d65e5799c9ea69 Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@xxxxxxxxx>
Date: Mon, 18 Oct 2010 11:16:40 +0300
Subject: [PATCH] Fix process pending request if transfer canceled

If the call to the Request method of the obex client agent returns
with an error (for example if the transfer is rejected), call
function session_terminate_transfer instead of unregister_transfer
to both unregister the transfer and handle the pending request.
---
 client/session.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/client/session.c b/client/session.c
index ce3432d..0e635e7 100644
--- a/client/session.c
+++ b/client/session.c
@@ -89,6 +89,9 @@ struct agent_data {
 
 static void session_prepare_put(struct session_data *session, GError *err,
 								void *data);
+static void session_terminate_transfer(struct session_data *session,
+					struct transfer_data *transfer,
+					GError *gerr);
 
 static GQuark obex_io_error_quark(void)
 {
@@ -803,11 +806,17 @@ static void session_request_reply(DBusPendingCall *call, gpointer user_data)
 
 	dbus_error_init(&derr);
 	if (dbus_set_error_from_message(&derr, reply)) {
+		GError *gerr = NULL;
+
 		error("Replied with an error: %s, %s",
 				derr.name, derr.message);
 		dbus_error_free(&derr);
 		dbus_message_unref(reply);
-		transfer_unregister(pending->transfer);
+
+		g_set_error(&gerr, OBEX_IO_ERROR, -ECANCELED, "%s", derr.message);
+		session_terminate_transfer(session, pending->transfer, gerr);
+		g_clear_error(&gerr);
+
 		return;
 	}
 
-- 
1.6.0.4


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux