Diff between ba377e0462513b64b4ae2d2dc8023c692bfae296 and 8888c5ae47209d1fe07de62bf51928d26d786fa4
Changed Files
| File | Additions | Deletions | Status |
| gobex/gobex-packet.c | +9 | -0 | modified |
Full Patch
diff --git a/gobex/gobex-packet.c b/gobex/gobex-packet.c
index 16d4b7a..e5bf618 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;
}