[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Handling concurent evhttp connections with evhttp_send_reply_chunk.
- To: libevent-users@xxxxxxxxxxxxx
- Subject: Re: [Libevent-users] Handling concurent evhttp connections with evhttp_send_reply_chunk.
- From: Niels Provos <provos@xxxxxxxxx>
- Date: Wed, 18 Nov 2009 10:40:25 -0800
- Cc: libevent-users@xxxxxxxx
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Wed, 18 Nov 2009 13:40:29 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=M6Xk5mP/C6pGlB2wrTe/LHoGhoMc3gFKm2rLJyOcwGQ=; b=TNdM6PfUA+Ow+kKfXjCAah4MUTz59BZ1wtagozXFkynlb6YrON8qjgUPHLRGW2ZPpP NqIAKCSYuZXyaQPm7vkwwnrO3xOyvR3SGotqA769w/zxQORgulf7mke1kKxYKOm3ktRo EfGHXjmndn+ZSlEmSVA33ihz2dYFRUuL3vD48=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=BD1XQd5GHObxnpEu0L3FClgb5kAnNepnIxyHY3ft/HeZVgGh/iMJ/S6Vof8ZhG63Yv nR4TvueiIZJyBiTd78ML4nZXX7aDk7yQEgrS6tqyvPHQkFzsZKgIABvv4Fn+FVZ0y88J pLaqkX5w044MhgUxA8qmoY0x3sY4USWW7PZjE=
- In-reply-to: <1258391569.18146.16.camel@tani>
- References: <1258391569.18146.16.camel@tani>
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
On Mon, Nov 16, 2009 at 9:12 AM, Krzysztof Adamski <k@xxxxxxxx> wrote:
> 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.
Alternatively, you could read files in a separate process or thread
and then send data out as it becomes available.
> 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.
Let me know if you have further questions.
Thanks,
Niels.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.