OSDN Git Service

gobex: fix not tracking received responses
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 11 Nov 2011 14:29:04 +0000 (16:29 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 4 Dec 2012 21:22:04 +0000 (22:22 +0100)
obex->rx_last_op is only updated if there is no pending request which
means it only store last received request.

gobex/gobex.c

index b0f3716..e2d9c6c 100644 (file)
@@ -860,19 +860,20 @@ static gboolean incoming_data(GIOChannel *io, GIOCondition cond,
        if (obex->rx_data < 3 || obex->rx_data < obex->rx_pkt_len)
                return TRUE;
 
+       obex->rx_last_op = obex->rx_buf[0] & ~FINAL_BIT;
+
        if (obex->pending_req) {
                struct pending_pkt *p = obex->pending_req;
                opcode = g_obex_packet_get_operation(p->pkt, NULL);
                header_offset = rsp_header_offset(opcode);
        } else {
-               opcode = obex->rx_buf[0] & ~FINAL_BIT;
+               opcode = obex->rx_last_op;
                /* Unexpected response -- fail silently */
                if (opcode > 0x1f && opcode < 0xff) {
                        obex->rx_data = 0;
                        return TRUE;
                }
                header_offset = req_header_offset(opcode);
-               obex->rx_last_op = opcode;
        }
 
        if (header_offset < 0) {