[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[patch] Re: Can modules block on socket writes?

On Tue, 13 Mar 2001, Marcus Gruendler wrote:

> How does TUX handle a write( req->sock, ... ) ? [...]

not very well.

> Is it possible that the module blocks for example if there is a slow
> client, [...]

yes, this can happen.

> or does TUX swallow everything that's written by the module and
> handles the client reply in the same way it handles static replies?

nope, TUX doesnt catch write()s to the socket.

> The latter mechanism would be very nice to have in order to take
> complexity from the module.

that doesnt take care of the issue of making it event-based.

please check out the -S6 patch i've just uploaded, plus the new 2.0.19
tarball. I've implemented TUX_ACTION_SEND_BUFFER, which is an asynchron,
event-based send-buffer function for TUX modules. The tarball includes
demo5.c which shows how to use it:



requests are automatically scheduled away by TUX if there is not enough
write space, and req->event should be used to catch the completion event.
This can be used to malloc()/free() temporary userspace buffers as well.

TUX_ACTION_SEND_BUFFER is from now on the preferred method of sending data
to the client. write() to the socket can still be used, but only from
helper threads, to not block the whole TUX process with a slow client.

does this mechanism solve your problem?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []