No comments on this one ?

Eric.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Lapuyade
Sent: lundi 3 décembre 2007 11:35
To: openobex-users@lists.sourceforge.net
Subject: Re: [openobex-users] OBEX_EV_REQDONE mode problem in cvs version

Hi,

The fix Frederic proposed is actually not good. There is a problem when
the event callback starts a new request. For example, I use the CONNECT
EV_REQDONE to start a new PUT request, and that would fail with this
change. The new PUT request initializes the state as it likes and then
the event callback returns. But at this time, the state would be
overridden with MODE_SRV.

Let me summarize the last changes:

At changestate 262, the state initialization was moved before calling
obex_deliver_event. This was bad because obex_deliver_event uses it to
determine the current mode. So it broke all the code who actually use
the mode parameter in the event callback.

Frederic proposed to move the state initialization after
obex_deliver_event. This is the patch Christian W. Zuckschwerdt said he
put on his todo list. But it is also bad to set the state after
obex_deliver_event for the reason I mentioned above.

I think the right way to fix this is to pre-initialize the next state
before calling obex_deliver_event, and to pass the current state to
obex_deliver_event as follows:

OLD IMPLEMENTATION
------------------
void obex_deliver_event(obex_t *self, int event, int cmd, int rsp, int
del)
{
        obex_object_t *object = self->object;

        if (del == TRUE)
                self->object = NULL;

        if (self->state & MODE_SRV)
                self->eventcb(self, object, OBEX_MODE_SERVER, event,
cmd, rsp);
        else
                self->eventcb(self, object, OBEX_MODE_CLIENT, event,
cmd, rsp);
        
        if (del == TRUE)
                obex_object_delete(object);
}

NEW PROPOSED IMPLEMENTATION
---------------------------
void obex_deliver_event(obex_t *self, int event, int cmd, int rsp, int
del, int mode)
{
        obex_object_t *object = self->object;

        if (del == TRUE)
                self->object = NULL;

        self->eventcb(self, object, mode, event, cmd, rsp);
        
        if (del == TRUE)
                obex_object_delete(object);
}

I'm sorry I don't provide a patch file, but I'm fairly new to this open
source development process and I'm not sure exactly how to proceed. I
think however my explanation above is clear enough to understand. Don't
hesitate to correct me if this is wrong.

Eric.

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Openobex-users mailing list
Openobex-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/openobex-users

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Openobex-users mailing list
Openobex-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to