diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-02-11 16:00:47 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-02-20 13:43:08 +0200 |
commit | 7b43cc9e4f0ed814d57a97844a22414588f44b18 (patch) | |
tree | 314871b22ecee7bca9015c1d59ba526975f38793 /gobex | |
parent | fa0701592b1638302159f5bb72f7fd71ce02df7c (diff) | |
download | bluez-7b43cc9e4f0ed814d57a97844a22414588f44b18.tar.gz |
gobex: Fix not handling SRM properly
SRM can be enabled but while not active with use of SRMP header so the
handling of this states needs to be separated.
Diffstat (limited to 'gobex')
-rw-r--r-- | gobex/gobex.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/gobex/gobex.c b/gobex/gobex.c index 8c08b1e35..291ed72e5 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; /* |