Dnia 2009-11-18, śro o godzinie 10:40 -0800, Niels Provos pisze:
> On Mon, Nov 16, 2009 at 9:12 AM, Krzysztof Adamski <k@xxxxxxxx> wrote:Watermarks seams like a good thing for my case but I just don't accually
> > i would like to build simple HTTPD server using libevent2. It is going
> > to send some quite big files but i would like it to handle couple
> > concurrent connections. The files can be sent in chunks so I'm using
> > evhttp_send_reply_chunk for this. The problem is, how can I send big
> > files while still being able to handle new connections?
>
> The way that chunked connections work at the moment is that you need
> some other event to drive new data being sent to the client. The
> problem with a single-threaded server is not blocking on the file
> reads. In libevent-1.4, there is no way to set watermarks or similar
> feedback mechanisms. However, as we have switched to bufferevents in
> libevent-2.0; this should be possible.
know how to use them with evhttp. I would be glad for any details (I'm
libevent newbie and there is not too much of a documentation i could
find, unfortunatly).
Is is not really something i would like to do. I can write a server that
> Alternatively, you could read files in a separate process or thread
> and then send data out as it becomes available.
will serv big files to couple clients in one thread using
select/poll/epoll manually with one thread and one process so i think it
should be possible with libevent too.
Yes, exactly. It would be really great if there was a way to register a
> > when client disconnect in the middle of the transfer, however. I can't
> > get fd of the connection form evhttp_request so it's impossible to set
> > event callback for EV_WRITE instead of EV_TIMEOUT.
>
> The problem with how chunked connections work at the moment is that
> you do not get any feedback when they client has closed the
> connection. I will need to take another look at that and write a test
> case for the scenario.
callback for sending more data and another one for cleaning when client
is disconnected. That's not something I'm currently able to write
myself, however.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.