Agreed. The most optimal way of doing this would be to use your operating
system's sendfile() routine, where available, in the evhttp_write_cb
routine.

-Patrick

2009/11/16 Tero Marttila <te...@fixme.fi>

> Krzysztof Adamski wrote:
>
>> Hi,
>> 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?
>>
>
> One option is to add the functionality to evhttp.
>
> I don't have any concrete patches to post, but when I tried this a (long)
> while ago, it was fairly straightforward, just building on top of the
> existing bufferevent watermark functionality.
>
> More specifically, it amounted to having evhttp_write_buffer apply a
> suitable bufferevent_setwatermark (EV_WRITE lowmark) when called from within
> evhttp_send_reply_chunk, setting up evcon->cb to invoke the user's "send
> more data" callback from evhttp_write_cb. This worked, to the extent that I
> tested it.
>
>  -- Tero Marttila
>
> ***********************************************************************
> To unsubscribe, send an e-mail to majord...@freehaven.net with
> unsubscribe libevent-users    in the body.
>

Reply via email to