[PATCH obexd 7/7] gobex: dump data when G_OBEX_DEBUG_DATA is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

---
 gobex/gobex.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gobex/gobex.c b/gobex/gobex.c
index 0a381a5..fa660ad 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -202,6 +202,8 @@ static gboolean write_stream(GObex *obex, GError **err)
 	if (status != G_IO_STATUS_NORMAL)
 		return FALSE;
 
+	g_obex_dump("<", buf, bytes_written);
+
 	obex->tx_sent += bytes_written;
 	obex->tx_data -= bytes_written;
 
@@ -223,6 +225,8 @@ static gboolean write_packet(GObex *obex, GError **err)
 	if (bytes_written != obex->tx_data)
 		return FALSE;
 
+	g_obex_dump("<", buf, bytes_written);
+
 	obex->tx_sent += bytes_written;
 	obex->tx_data -= bytes_written;
 
@@ -720,7 +724,7 @@ static gboolean read_stream(GObex *obex, GError **err)
 
 	obex->rx_data += rbytes;
 	if (obex->rx_data < 3)
-		return TRUE;
+		goto done;
 
 	memcpy(&u16, &buf[1], sizeof(u16));
 	obex->rx_pkt_len = g_ntohs(u16);
@@ -734,7 +738,7 @@ static gboolean read_stream(GObex *obex, GError **err)
 
 read_body:
 	if (obex->rx_data >= obex->rx_pkt_len)
-		return TRUE;
+		goto done;
 
 	do {
 		toread = obex->rx_pkt_len - obex->rx_data;
@@ -742,11 +746,14 @@ read_body:
 
 		status = g_io_channel_read_chars(io, buf, toread, &rbytes, NULL);
 		if (status != G_IO_STATUS_NORMAL)
-			return TRUE;
+			goto done;
 
 		obex->rx_data += rbytes;
 	} while (rbytes > 0 && obex->rx_data < obex->rx_pkt_len);
 
+done:
+	g_obex_dump(">", obex->rx_buf, obex->rx_data);
+
 	return TRUE;
 }
 
@@ -791,6 +798,8 @@ static gboolean read_packet(GObex *obex, GError **err)
 		return FALSE;
 	}
 
+	g_obex_dump(">", obex->rx_buf, obex->rx_data);
+
 	return TRUE;
 fail:
 	g_obex_debug(G_OBEX_DEBUG_ERROR, "%s", (*err)->message);
-- 
1.7.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux