diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2012-02-18 17:18:56 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-20 00:17:28 +0200 |
commit | e712d50be4683babd342426a23413f402c43bfdb (patch) | |
tree | e44c9743940cf4d82b275dd7e93f4e98ca24fa9b /src | |
parent | 8ab2b76098812abc3b1e3f72acd0e45e5dd334ef (diff) | |
download | obexd-e712d50be4683babd342426a23413f402c43bfdb.tar.gz |
core: Fix queueing packet containing error while suspended
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/obex-priv.h | 1 | ||||
-rw-r--r-- | 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; @@ -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); |