Hello!
On Wed, Feb 11, 2015 at 11:42 PM,
li...@die-jansens.de wrote:
>
> So I take it that I currently can't do that. What I'm wondering about is
> why the socket gets closed in the first place, even though the variable
> doesn't go out of scope. What is the reasoning behind this?
>
According to the current implementation, cosocket objects' lifetime
and scope cannot go across the creating request handler's boundary.
One has to rely on ngx_lua's builtin connection/socket pools to reuse
the underlying connections/sockets. This design decision eliminates
many (if not all) programming mistakes by incorrectly sharing cosocket
objects across different nginx requests and it also simplifies
resource management.
Regards,
-agentzh