Userspace module return value?

Marek Habersack grendel at caudium.net
Tue Jul 20 14:19:01 UTC 2004


On Tue, Jul 20, 2004 at 04:00:21PM +0200, Ingo Molnar scribbled:
> 
> * Marek Habersack <grendel at caudium.net> wrote:
> 
> > if (rval == REQ_STATIC) {
> >     req->event = 1;
> >     do_syslog("Static request, getting the object (%s)", req->objectname);
> >     rval = tux(TUX_ACTION_GET_OBJECT, req);
> >     if (rval < 0 || req->error) {
> >       req->event = 2;
> >       if (content_type(req) == CONTENT_NOTIFY) 
> >         return send_failure(req, LOG_ERR_OBJECT_NOT_FOUND);
> >       
> >       goto abort;
> >     }
> >     return rval;
> >   }
> 
> This code doesnt handle events properly. When tux() returns there might
> be another request active (with a different ->priv value) - you need to
> return so that your event loop can be re-called with the proper request
> pointer.
OK, I see the problem now. Above, I'm calling tux(TUX_ACTION_GET_OBJECT,
req) and if it fails I immediately call either tux(TUX_ACTION_SEND_BUFFER,
req) or tux(TUX_ACTION_FINISH_CLOSE_REQ, req) (in the 'abort; label) -
instead I should return immediately after the TUX_ACTION_GET_OBJECT call
fails and send the buffer or close the connection only the next time
handle_events is called. Did I get it right?

thanks,

marek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/tux-list/attachments/20040720/24e3bee6/attachment.sig>


More information about the tux-list mailing list