From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 1/2] Fix not responding to pbap GET when data is already cached
Date: Thu, 17 Feb 2011 10:53:28 +0200 [thread overview]
Message-ID: <1297932809-3460-1-git-send-email-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
When data is cached but no stream/body is set the driver .write is never
called so no response is generated.
---
src/obex.c | 35 +++++++++++++++--------------------
1 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/src/obex.c b/src/obex.c
index 98f0e4d..e6e22f5 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -813,30 +813,25 @@ static void cmd_get(struct obex_session *os, obex_t *obex, obex_object_t *obj)
/* Add body header */
hd.bs = NULL;
- if (os->size == 0)
- OBEX_ObjectAddHeader (obex, obj, OBEX_HDR_BODY,
- hd, 0, OBEX_FL_FIT_ONE_PACKET);
- else if (!stream) {
- /* Asynchronous operation that doesn't use stream */
+ if (os->size == 0) {
+ OBEX_ObjectAddHeader(obex, obj, OBEX_HDR_BODY, hd, 0,
+ OBEX_FL_FIT_ONE_PACKET);
+ goto done;
+ }
+
+ if (stream)
+ /* Standard data stream */
+ OBEX_ObjectAddHeader(obex, obj, OBEX_HDR_BODY, hd, 0,
+ OBEX_FL_STREAM_START);
+
+ /* Try to write to stream and suspend the stream immediately
+ * if no data available to send. */
+ err = obex_write_stream(os, obex, obj);
+ if (err == -EAGAIN) {
OBEX_SuspendRequest(obex, obj);
os->obj = obj;
os->driver->set_io_watch(os->object, handle_async_io, os);
return;
- } else {
- /* Standard data stream */
- OBEX_ObjectAddHeader (obex, obj, OBEX_HDR_BODY,
- hd, 0, OBEX_FL_STREAM_START);
-
- /* Try to write to stream and suspend the stream immediately
- * if no data available to send. */
- err = obex_write_stream(os, obex, obj);
- if (err == -EAGAIN) {
- OBEX_SuspendRequest(obex, obj);
- os->obj = obj;
- os->driver->set_io_watch(os->object, handle_async_io,
- os);
- return;
- }
}
done:
--
1.7.1
next reply other threads:[~2011-02-17 8:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-17 8:53 Luiz Augusto von Dentz [this message]
2011-02-17 8:53 ` [PATCH 2/2] Add workaround for devices which use absolute path in pbap Name header Luiz Augusto von Dentz
2011-02-17 18:45 ` [PATCH 1/2] Fix not responding to pbap GET when data is already cached Johan Hedberg
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=1297932809-3460-1-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/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).