linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [PATCH obexd v2 2/6] client: fix unreported error case
Date: Tue, 14 Feb 2012 15:47:05 +0100	[thread overview]
Message-ID: <1329230829-27046-3-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1329230829-27046-1-git-send-email-mikel.astiz.oss@gmail.com>

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

The authorization request of a queued transfer could fail, and this
needs to be reported to the transfer initiator. Otherwise it would
likely result in D-Bus timeouts.
---
 client/session.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/client/session.c b/client/session.c
index 28516b2..2f6df75 100644
--- a/client/session.c
+++ b/client/session.c
@@ -735,17 +735,31 @@ static void session_process_queue(struct obc_session *session)
 	if (session->queue == NULL || g_queue_is_empty(session->queue))
 		return;
 
+	obc_session_ref(session);
+
 	while ((p = g_queue_pop_head(session->queue))) {
 		int err;
 
 		err = pending_request_auth(p);
 		if (err == 0) {
 			session->p = p;
+			obc_session_unref(session);
 			return;
 		}
 
+		if (p->func) {
+			GError *gerr;
+
+			g_set_error(&gerr, OBEX_IO_ERROR, err,
+							"Authorization failed");
+			p->func(session, gerr, p->data);
+			g_error_free(gerr);
+		}
+
 		pending_request_free(p);
 	}
+
+	obc_session_unref(session);
 }
 
 static void session_terminate_transfer(struct obc_session *session,
-- 
1.7.6.5


  parent reply	other threads:[~2012-02-14 14:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-14 14:47 [PATCH obexd v2 0/6] Several minor fixes Mikel Astiz
2012-02-14 14:47 ` [PATCH obexd v2 1/6] client: fix memory leak in obc_session_put Mikel Astiz
2012-02-14 14:47 ` Mikel Astiz [this message]
2012-02-16 13:07   ` [PATCH obexd v2 2/6] client: fix unreported error case Johan Hedberg
2012-02-14 14:47 ` [PATCH obexd v2 3/6] client: fix incorrect error check Mikel Astiz
2012-02-14 14:47 ` [PATCH obexd v2 4/6] client: fix pbap select when same path given twice Mikel Astiz
2012-02-14 14:47 ` [PATCH obexd v2 5/6] client: queue transfers in ftp sessions Mikel Astiz
2012-02-14 14:47 ` [PATCH obexd v2 6/6] client: queue transfers in pbap sessions Mikel Astiz
2012-02-16  8:01 ` [PATCH obexd v2 0/6] Several minor fixes Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329230829-27046-3-git-send-email-mikel.astiz.oss@gmail.com \
    --to=mikel.astiz.oss@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mikel.astiz@bmw-carit.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).