How to implement handshake in an upstream module?

Yichun Zhang (agentzh) agentzh at gmail.com
Thu Dec 5 21:23:55 UTC 2013


Hello!

On Wed, Dec 4, 2013 at 10:27 PM, Reetesh Ranjan wrote:
> The handshake, the way it is in my specific case, is logically just an
> extension of the request and response streams. So just merged it into the
> same.
>
> client                           server
>        handshake . request  --->
>        <--- handshake . response
>
> So now things fit into the nginx state machine of upstream modules without
> any changes required.

You're essentially doing pipelined requests here and you will run into
the following limitation in the nginx core:

    http://mailman.nginx.org/pipermail/nginx-devel/2012-March/002040.html

I ran into this when testing my ngx_redis2 module's pipelined request
feature and my patch in that thread will help you :)

Also, you may also want to deal with keepalive connections in your
module in the future and you will want to save the handshake for
reused connections (from the connection pool).

Regards,
-agentzh



More information about the nginx-devel mailing list