Connection API?

Nick Kew nick at webthing.com
Mon Dec 3 15:57:24 UTC 2012


On Mon, 3 Dec 2012 18:42:48 +0400
Maxim Dounin <mdounin at mdounin.ru> wrote:

> As of now connection end may be hooked by using connection's pool 
> cleanup handler.  There is no connection start hook in the current 
> http module API.
> 
> It's probably worth adding, but I doubt we need full-featured API 
> here.  In particular, full ctx array would be huge compared to a 
> connection structure size which is kept small to minimize 
> keepalive connections costs.  And the demand for a connection start 
> hook looks extremelay low.

Thanks for the reply.  You mean you're happy to add a new-connection
hook, but not a context?

In an HTTP context I can work around that: my module maintains a
pool of connection contexts, and associates each new HTTP request
with its connection in a post_read_request hook.

Can I assume that if requests r1 and r2 come on the same connection
then r1->connection == r2->connection?  That would enable me to save
a little overhead by using the connection pointer as a hash key,
rather than having to compute a key from the connection data.

-- 
Nick Kew



More information about the nginx-devel mailing list