[PATCH obexd 1/2] gobex: flush tx_queue before disconnection

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

 



This patch send the packets in tx_queue before the actual disconnection
If the operation is aborted it just sends ABORT and ignore the
rest of the packets in the queue.
---
 gobex/gobex.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/gobex/gobex.c b/gobex/gobex.c
index bc76e57..496de46 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -1324,7 +1324,7 @@ GObex *g_obex_ref(GObex *obex)
 
 void g_obex_unref(GObex *obex)
 {
-	gboolean last_ref;
+	gboolean last_ref, ret;
 
 	last_ref = g_atomic_int_dec_and_test(&obex->ref_count);
 
@@ -1335,6 +1335,12 @@ void g_obex_unref(GObex *obex)
 
 	g_slist_free_full(obex->req_handlers, g_free);
 
+	do {
+		ret = write_data(obex->io, G_IO_OUT, obex);
+		if (obex->pending_req && obex->pending_req->cancelled)
+			break;
+	} while(ret);
+
 	g_queue_foreach(obex->tx_queue, (GFunc) pending_pkt_free, NULL);
 	g_queue_free(obex->tx_queue);
 
-- 
1.7.1

--
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