linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd 1/8] core: Fix queueing packet containing error while suspended
@ 2012-02-18 15:18 Luiz Augusto von Dentz
  2012-02-18 15:18 ` [PATCH obexd 2/8] gobex: Translate posix error code to proper OBEX response opcode Luiz Augusto von Dentz
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-18 15:18 UTC (permalink / raw)
  To: linux-bluetooth

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

Queueing the error won't remove the original packet created by transfer
from the queue so upon resume gobex will attempt to send it again.

To fix this we no longer create a error packet instead the session is
market as aborted and the error stored so when gobex finally resumes the
error is forward properly.
---
 src/obex-priv.h |    1 +
 src/obex.c      |   10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/obex-priv.h b/src/obex-priv.h
index 5b72942..41854bc 100644
--- a/src/obex-priv.h
+++ b/src/obex-priv.h
@@ -43,6 +43,7 @@ struct obex_session {
 	int64_t size;
 	void *object;
 	gboolean aborted;
+	int err;
 	struct obex_service_driver *service;
 	void *service_data;
 	struct obex_server *server;
diff --git a/src/obex.c b/src/obex.c
index 05cc068..a028156 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -554,7 +554,7 @@ static gssize send_data(void *buf, gsize size, gpointer user_data)
 									size);
 
 	if (os->aborted)
-		return -EPERM;
+		return os->err < 0 ? os->err : -EPERM;
 
 	return driver_read(os, buf, size);
 }
@@ -594,7 +594,7 @@ static int driver_get_headers(struct obex_session *os)
 	DBG("name=%s type=%s object=%p", os->name, os->type, os->object);
 
 	if (os->aborted)
-		return -EPERM;
+		return os->err < 0 ? os->err : -EPERM;
 
 	if (os->object == NULL)
 		return -EIO;
@@ -661,8 +661,10 @@ static gboolean handle_async_io(void *object, int flags, int err,
 		return TRUE;
 
 done:
-	if (err < 0)
-		os_set_response(os, err);
+	if (err < 0) {
+		os->err = err;
+		os->aborted = TRUE;
+	}
 
 	g_obex_resume(os->obex);
 
-- 
1.7.7.6


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

end of thread, other threads:[~2012-02-19 22:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-18 15:18 [PATCH obexd 1/8] core: Fix queueing packet containing error while suspended Luiz Augusto von Dentz
2012-02-18 15:18 ` [PATCH obexd 2/8] gobex: Translate posix error code to proper OBEX response opcode Luiz Augusto von Dentz
2012-02-18 15:18 ` [PATCH obexd 3/8] core: Make use of g_obex_errno_to_rsp to translate posix errors Luiz Augusto von Dentz
2012-02-18 15:18 ` [PATCH obexd 4/8] gobex: Use ENOSYS to correspond to OBEX not implemented Luiz Augusto von Dentz
2012-02-18 15:19 ` [PATCH obexd 5/8] core: Use ENOSYS to indicate not implemented function Luiz Augusto von Dentz
2012-02-18 15:19 ` [PATCH obexd 6/8] ftp: " Luiz Augusto von Dentz
2012-02-18 15:19 ` [PATCH obexd 7/8] core: " Luiz Augusto von Dentz
2012-02-18 15:19 ` [PATCH obexd 8/8] map: " Luiz Augusto von Dentz
2012-02-19 22:19 ` [PATCH obexd 1/8] core: Fix queueing packet containing error while suspended Johan Hedberg

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