[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: copas timeout?
- From: gary ng <garyng2000@...>
- Date: Sat, 13 Jun 2009 10:54:27 -0700 (PDT)
I don't think copas works the way you describe.
copas.receive(skt,"*l") would put the thread in 'suspended' state when the lower socket layer return 'timeout'(and the timeout is always 0) until it gets a full line or the socket is closed.
You are right that if you want to put a timeout on stalled connection, that would be in the copas interal loop.
I believe I have submitted some patch which is a watchdog function that was mainly designed for really stalled connection where the select() would never come back.
--- On Sun, 6/14/09, Eike Decker <zet23t@googlemail.com> wrote:
> From: Eike Decker <zet23t@googlemail.com>
> Subject: copas timeout?
> To: "Lua list" <lua@bazar2.conectiva.com.br>
> Date: Sunday, June 14, 2009, 1:27 AM
> Hi
>
> I am writing a tiny webserver which is now also supporting
> the
> keepalive feature of HTTP/1.1. Thus I am now not closing
> the socket.
> But by testing I found that some browsers don't close the
> connection
> for quite long times. I would like to limit this keep-open
> period to a
> certain maximum time, but it looks to me like I would need
> to modify
> the copas.lua sourcecode for doing that, is this right?
> Actually, I expected that copas.receive would accept a
> timeout
> variable, i.e. copas.receive(skt,"*l",120) that would
> return with a
> "timeout" error after 120 seconds, but this was not the
> case when I
> looked up the source. Wouldn't it make sense to support
> this in copas?
> I found copas so far really very useful.
>
> Eike
>