summaryrefslogtreecommitdiff
path: root/gobex
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-04-07 13:56:51 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-04-08 16:27:49 +0300
commit35938b779dc8d2498e66e6a6483a36c1f99c2e19 (patch)
tree1e824c9dde7b01da5323104825065f8f6e71926b /gobex
parent1d23383bfee0cac5a9b4191af41a30246affe5e8 (diff)
downloadbluez-35938b779dc8d2498e66e6a6483a36c1f99c2e19.tar.gz
gobex: Fix being able to cancel completed requests
This fixes bogus responses when rsp_func calls g_obex_cancel_req for responses with final bit set.
Diffstat (limited to 'gobex')
-rw-r--r--gobex/gobex.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gobex/gobex.c b/gobex/gobex.c
index 7f859383a..850e288af 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -1098,6 +1098,10 @@ static void handle_response(GObex *obex, GError *err, GObexPacket *rsp)
p = obex->pending_req;
+ /* Reset if final so it can no longer be cancelled */
+ if (final_rsp)
+ obex->pending_req = NULL;
+
if (p->cancelled)
err = g_error_new(G_OBEX_ERROR, G_OBEX_ERROR_CANCELLED,
"The operation was cancelled");
@@ -1116,10 +1120,8 @@ static void handle_response(GObex *obex, GError *err, GObexPacket *rsp)
if (p->cancelled)
g_error_free(err);
- if (final_rsp) {
+ if (final_rsp)
pending_pkt_free(p);
- obex->pending_req = NULL;
- }
if (!disconn && g_queue_get_length(obex->tx_queue) > 0)
enable_tx(obex);