Skip to content

Commit fa09be5

Browse files
committed
send data later when send() returns zero in ngx_http_check_send_handler()
When the remote tcp receive buffer has been filled up or the local send buffer is completely full, send() could easily return zero. 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`.
1 parent 1999558 commit fa09be5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ngx_http_upstream_check_handler.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,10 +544,10 @@ ngx_http_check_send_handler(ngx_event_t *event)
544544
size, ctx->send.last - ctx->send.pos);
545545
#endif
546546

547-
if (size >= 0) {
547+
if (size > 0) {
548548
ctx->send.pos += size;
549549

550-
} else if (size == NGX_AGAIN) {
550+
} else if (size == 0 || size == NGX_AGAIN) {
551551
return;
552552

553553
} else {

0 commit comments

Comments
 (0)