Question about multiple upstream-> calls

Mike Gagnon mikegagnon at
Wed Apr 11 02:50:43 UTC 2012


I am developing a load-balancing module for nginx. I have noticed that
when a peer fails (say because the connection was reset by the peer)
the r->upstream-> function is called multiple times on the
same peer connection: the first time with state == NGX_PEER_FAILED
set, and the second time with state == 0.

What is the purpose of calling multiple times? Is there a
recommended way to tell if a call to is the first call (for
that peer connection)? Or to tell if it is the last call (for that
peer connection)?

This issue is important for the correctness of my code.


Mike Gagnon

More information about the nginx-devel mailing list