Userspace module return value?

Marek Habersack grendel at caudium.net
Tue Jul 20 12:29:47 UTC 2004


Hello list,

  I have a problem with a userspace module I have written for Tux. Tux is
configured to forward all the connections to that module which, in turn,
decides whether the visitor is authorized to access the server and, if yes,
how to handle the connection - whether to have tux send a static file or the
backend handle a dynamic resource. Everything works fine except for one
"detail" - once every few requests, the following happens:

Jul 20 06:28:47 localhost kernel: Possibly unexpected TUX-thread exit(0) at c0117da3?
Jul 20 06:28:47 localhost kernel: TUX: thread 0 stopping ...
Jul 20 06:28:47 localhost kernel: TUX: thread 0 stopped.

I have determined that this happens when I return a wrong value from the
handle_events function. The problem is, I have no idea what is "wrong" or "good"
value to return from the function? The first version of the module was
returning whatever it got from the tux() syscall, but the above problem was
appearing even then. It seems to happen only after the _last_ resource
pertaining to a single request is sent (e.g. I am serving a static HTML page
with several images, when the last image request is satisfied, the module
exits in the way shown in the log excerpt above). It's definitely a case of
an incorrect return value from the handle_events function - but I can't find
any documentation on what the return value means in this case. I have found
a solution which takes care of the problem, but feels like a hack - I'm
returning TUX_RETURN_USERSPACE_REQUEST every time except when closing the
connection, when I return the value returned from
tux(TUX_ACTION_FINISH_CLOSE_REQ, req). That seems to work so far, but is it
the right solution? Could anybody, please, shed some light on the
handle_events return value?

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/d59d23f5/attachment.sig>


More information about the tux-list mailing list