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

This make possible to cancel pending operation with a proper error
instead of always respond using OBEX_RSP_UNAUTHORIZED.
---
 lib/obex.c      |    4 ++--
 lib/obex_main.c |    6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/obex.c b/lib/obex.c
index 00f90d7..270b3ee 100644
--- a/lib/obex.c
+++ b/lib/obex.c
@@ -520,8 +520,8 @@ int CALLAPI OBEX_Request(obex_t *self, obex_object_t 
*object)
 /**
        Cancel an ongoing operation.
        \param self OBEX handle
-       \param nice If true an OBEX Abort will be sent if beeing client
-       or OBEX_RSP_UNAUTHORIZED as reponse if beeing server.
+       \param nice If true or > 0 an OBEX Abort will be sent if beeing client
+       or it will be used as reponse if beeing server.
        \return -1 on error
  */
 LIB_SYMBOL
diff --git a/lib/obex_main.c b/lib/obex_main.c
index d38a711..c58b1be 100644
--- a/lib/obex_main.c
+++ b/lib/obex_main.c
@@ -358,7 +358,11 @@ int obex_cancelrequest(obex_t *self, int nice)
                if (object == NULL)
                        return -1;
 
-               obex_object_setcmd(object, OBEX_CMD_ABORT, OBEX_CMD_ABORT);
+               if (self->state & MODE_SRV)
+                       obex_object_setcmd(object, nice, nice);
+               else
+                       obex_object_setcmd(object, OBEX_CMD_ABORT,
+                                                       OBEX_CMD_ABORT);
 
                if (obex_object_send(self, object, TRUE, TRUE) < 0) {
                        obex_object_delete(object);
-- 
1.7.1


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Openobex-users mailing list
Openobex-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to