alibaba/tengine — pull request #226 by chobits (2013-04-09 09:04:34+00:00)
Title: health check: check return value @size of send() or recv()

* check active close from peer in ngx_http_upstream_check_recv_handler():

If there is no data to receive, we finish the health check before timeout.
Note that, without this patch, timeout handler will do it for us.

* send data later when send() returns 0 in ngx_http_upstream_check_send_handler():

When the remote tcp receive buffer has been filled up or the local send
buffer is completely full, send() could easily returns 0.
In this case, we should send data later just like we handle NGX_AGAIN.

A good example from nginx is in ngx_mail_send(), which does the same thing
for `n == 0` and `n == NGX_AGAIN`.

This patch has been commited to https://github.com/yaoweibin/nginx_upstream_check_module/commit/fa09be5eaedd24db07518abb8517a6b10e6d7fb0