Hi,

On Thu, Oct 14, 2010 at 4:00 PM, Hendrik Sattler
<p...@hendrik-sattler.de> wrote:
> Zitat von "Luiz Augusto von Dentz" <luiz.de...@gmail.com>:
>
>> From: Luiz Augusto von Dentz <luiz.dentz-...@nokia.com>
>>
>> Make use of last response set if nice is TRUE, so that applications can
>> set a proper error when canceling a suspended requests.
>> ---
>>  lib/obex.c      |    2 +-
>>  lib/obex_main.c |   13 ++++++++++++-
>>  2 files changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/obex.c b/lib/obex.c
>> index 00f90d7..29723ec 100644
>> --- a/lib/obex.c
>> +++ b/lib/obex.c
>> @@ -521,7 +521,7 @@ 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.
>> +       or respond with an error if beeing server.
>>        \return -1 on error
>>  */
>>  LIB_SYMBOL
>> diff --git a/lib/obex_main.c b/lib/obex_main.c
>> index d38a711..0a72c14 100644
>> --- a/lib/obex_main.c
>> +++ b/lib/obex_main.c
>> @@ -358,7 +358,18 @@ 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->mode == MODE_SRV) {
>> +                       /* Do not send continue */
>> +                       if (self->object->opcode != OBEX_RSP_CONTINUE)
>> +                               obex_object_setrsp(object,
>> self->object->opcode,
>> +                                               self->object->lastopcode);
>
> Why do you create a new object also for the server case and don't just use
> self->object to send the response?
> Minor objection, though.

I thougth I had already explained why this is not a good idea, here we
go again, we have 2 big problems when reusing the object:

1. There could be already data/headers/body written to the object
since this is meant for suspended requests and we don't want to send
them if we are canceling.
2. Reusing the object would probably make it impossible to cancel
requests without making sure there are no other entity holding the
object because as I said in 1 there could be data there and we would
have to cleanup this data before sending the object.

IMO marking abort is much safer here since it make similar to real
abort requests which application already have to handle anyway.

-- 
Luiz Augusto von Dentz
Computer Engineer

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Openobex-users mailing list
Openobex-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to