From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: patrick.ohly@intel.com
Subject: [PATCH BlueZ 6/8] gobex: Fix not handling SRM properly
Date: Fri, 14 Feb 2014 17:53:02 +0200 [thread overview]
Message-ID: <1392393184-15266-6-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1392393184-15266-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
SRM can be enabled but while not active with use of SRMP header so the
handling of this states needs to be separated.
---
gobex/gobex.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/gobex/gobex.c b/gobex/gobex.c
index 8c08b1e..291ed72 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -355,9 +355,20 @@ done:
obex->srm = NULL;
}
+static gboolean g_obex_srm_enabled(GObex *obex)
+{
+ if (!obex->use_srm)
+ return FALSE;
+
+ if (obex->srm == NULL)
+ return FALSE;
+
+ return obex->srm->enabled;
+}
+
static void check_srm_final(GObex *obex, guint8 op)
{
- if (obex->srm == NULL || !obex->srm->enabled)
+ if (!g_obex_srm_enabled(obex))
return;
switch (obex->srm->op) {
@@ -423,7 +434,7 @@ static gboolean write_data(GIOChannel *io, GIOCondition cond,
setup_srm(obex, p->pkt, TRUE);
- if (g_obex_srm_active(obex))
+ if (g_obex_srm_enabled(obex))
goto encode;
/* Can't send a request while there's a pending one */
@@ -646,7 +657,7 @@ guint g_obex_send_req(GObex *obex, GObexPacket *req, int timeout,
if (obex->rx_last_op == G_OBEX_RSP_CONTINUE)
goto create_pending;
- if (g_obex_srm_active(obex) && obex->pending_req != NULL)
+ if (g_obex_srm_enabled(obex) && obex->pending_req != NULL)
goto create_pending;
hdr = g_obex_packet_get_header(req, G_OBEX_HDR_CONNECTION);
@@ -860,10 +871,7 @@ gboolean g_obex_srm_active(GObex *obex)
{
gboolean ret = FALSE;
- if (!obex->use_srm)
- return FALSE;
-
- if (obex->srm == NULL || !obex->srm->enabled)
+ if (!g_obex_srm_enabled(obex))
goto done;
if (obex->srm->srmp <= G_OBEX_SRMP_NEXT_WAIT)
@@ -912,7 +920,7 @@ static gboolean parse_response(GObex *obex, GObexPacket *rsp)
setup_srm(obex, rsp, FALSE);
- if (!g_obex_srm_active(obex))
+ if (!g_obex_srm_enabled(obex))
return final;
/*
--
1.8.5.3
next prev parent reply other threads:[~2014-02-14 15:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-14 15:52 [PATCH BlueZ 1/8] obexd/transfer: Add Transfer.Suspend method Luiz Augusto von Dentz
2014-02-14 15:52 ` [PATCH BlueZ 2/8] obexd/transfer: Add Transfer.Resume method Luiz Augusto von Dentz
2014-02-14 15:52 ` [PATCH BlueZ 3/8] tools/obexctl: Add suspend command Luiz Augusto von Dentz
2014-02-14 15:53 ` [PATCH BlueZ 4/8] tools/obexctl: Add resume command Luiz Augusto von Dentz
2014-02-14 15:53 ` [PATCH BlueZ 5/8] unit/test-gobex-transfer: Add /gobex/test_packet_get_req_suspend_resume Luiz Augusto von Dentz
2014-02-14 15:53 ` Luiz Augusto von Dentz [this message]
2014-02-14 15:53 ` [PATCH BlueZ 7/8] gobex: Handle suspending/resuming for GET when SRM is active Luiz Augusto von Dentz
2014-02-14 15:53 ` [PATCH BlueZ 8/8] doc/obex-api: Update documentation Luiz Augusto von Dentz
2014-02-17 7:24 ` Andrei Emeltchenko
2014-02-18 9:09 ` Patrick Ohly
2014-02-18 9:30 ` Luiz Augusto von Dentz
2014-02-18 16:54 ` Patrick Ohly
2014-02-19 17:11 ` Luiz Augusto von Dentz
2014-02-20 10:52 ` Patrick Ohly
2014-02-20 12:09 ` 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=1392393184-15266-6-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=patrick.ohly@intel.com \
/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