linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd 1/2] gobex: flush tx_queue before disconnection
@ 2012-03-08  6:48 Jaganath Kanakkassery
  2012-03-08 23:42 ` Johan Hedberg
  0 siblings, 1 reply; 6+ messages in thread
From: Jaganath Kanakkassery @ 2012-03-08  6:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jaganath Kanakkassery

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-03-16 14:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-08  6:48 [PATCH obexd 1/2] gobex: flush tx_queue before disconnection Jaganath Kanakkassery
2012-03-08 23:42 ` Johan Hedberg
2012-03-09 12:33   ` Jaganath
2012-03-09 13:08     ` Johan Hedberg
2012-03-12  5:42       ` Jaganath
2012-03-16 14:31         ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).