summaryrefslogtreecommitdiff
path: root/gobex/gobex-packet.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2011-07-05 18:29:55 +0300
committerMarcel Holtmann <marcel@holtmann.org>2012-12-04 22:21:59 +0100
commit8888c5ae47209d1fe07de62bf51928d26d786fa4 (patch)
tree499a40d6a26176a3a00f8375e767fc833be1c429 /gobex/gobex-packet.c
parentba377e0462513b64b4ae2d2dc8023c692bfae296 (diff)
downloadbluez-8888c5ae47209d1fe07de62bf51928d26d786fa4.tar.gz
gobex: Fix end of body packets for on-demand headers
Diffstat (limited to 'gobex/gobex-packet.c')
-rw-r--r--gobex/gobex-packet.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gobex/gobex-packet.c b/gobex/gobex-packet.c
index 16d4b7a77..e5bf618ac 100644
--- a/gobex/gobex-packet.c
+++ b/gobex/gobex-packet.c
@@ -290,6 +290,15 @@ gssize g_obex_packet_encode(GObexPacket *pkt, guint8 *buf, gsize len)
if (ret < 0)
return ret;
+ /* Fix-up on-demand body header type and final bit. This
+ * breaks the layers of abstraction a bit but it's the
+ * simplest way to avoid two consecutive empty packets */
+ if (g_obex_header_get_id(hdr) == G_OBEX_HDR_ID_BODY &&
+ ret == 3) {
+ buf[0] |= FINAL_BIT;
+ buf[count] = G_OBEX_HDR_ID_BODY_END;
+ }
+
count += ret;
}