Hi, On Mon, Oct 18, 2010 at 2:55 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> >> >> Also deliver ABORT signal so the user application can free whatever >> resource being use to handle the request. >> --- >> lib/obex_main.c | 7 +++++++ >> 1 files changed, 7 insertions(+), 0 deletions(-) >> >> diff --git a/lib/obex_main.c b/lib/obex_main.c >> index 0a72c14..5f1f6e6 100644 >> --- a/lib/obex_main.c >> +++ b/lib/obex_main.c >> @@ -378,6 +378,13 @@ int obex_cancelrequest(obex_t *self, int nice) >> >> obex_object_delete(object); >> >> + if (self->mode == MODE_SRV) { >> + self->state = STATE_IDLE; >> + obex_deliver_event(self, OBEX_EV_ABORT, >> + self->object->opcode, 0, >> TRUE); > > I know that most obex_deliver_event() calls are not correct when they signal > errors (like above your changed lines in the very same function) but let's > try not to instroduce additional ones :-) > self->object->opcode contains the response code at this point, most likely. > You want to use obex_object_getcmd(); you need to make it global > (non-static) first, though. > > Why is this event only sent for a server, anyway? For the "!nice" part we > send it unconditionally, obex_object_getcmd() will give you the right one > for server and client.
Yep, it should be sent to the client too, good catch. Now about obex_object_getcmd we can fix it in another patch since Im afraid there quite a few places where we need to fix it, so for now Im going to use 0. > >> + return 0; >> + } >> + >> self->object->abort = TRUE; >> self->state = STATE_REC; >> The patch now looks like this: diff --git a/lib/obex_main.c b/lib/obex_main.c index 0a72c14..c16aa04 100644 --- a/lib/obex_main.c +++ b/lib/obex_main.c @@ -379,7 +379,10 @@ int obex_cancelrequest(obex_t *self, int nice) obex_object_delete(object); self->object->abort = TRUE; - self->state = STATE_REC; + self->state = self->mode == MODE_SRV ? STATE_IDLE : STATE_REC; + + /* Deliver event will delete the object */ + obex_deliver_event(self, OBEX_EV_ABORT, 0, 0, TRUE); return 0; } -- 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