# HG changeset patch # User Valentin Bartenev # Date 1409158261 -14400 # Node ID 6bbad2e732458bf53771e80c63a654b3d7f61963 # Parent 26d28506282aa91aa3c1e1cceab9bc56b48579fa Fixed counting of sent bytes in the send chain functions on EINTR. Previously, a value of the "send" variable wasn't properly adjusted in a rare case when syscall was interrupted by a signal. As a result, these functions could send less data than the limit allows. diff --git a/src/os/unix/ngx_darwin_sendfile_chain.c b/src/os/unix/ngx_darwin_sendfile_chain.c --- a/src/os/unix/ngx_darwin_sendfile_chain.c +++ b/src/os/unix/ngx_darwin_sendfile_chain.c @@ -308,6 +308,7 @@ ngx_darwin_sendfile_chain(ngx_connection in = ngx_handle_sent_chain(in, sent); if (eintr) { + send = prev_send + sent; continue; } diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c --- a/src/os/unix/ngx_freebsd_sendfile_chain.c +++ b/src/os/unix/ngx_freebsd_sendfile_chain.c @@ -378,6 +378,7 @@ ngx_freebsd_sendfile_chain(ngx_connectio } if (eintr) { + send = prev_send + sent; continue; } diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c --- a/src/os/unix/ngx_linux_sendfile_chain.c +++ b/src/os/unix/ngx_linux_sendfile_chain.c @@ -316,6 +316,7 @@ ngx_linux_sendfile_chain(ngx_connection_ in = ngx_handle_sent_chain(in, sent); if (eintr) { + send = prev_send; continue; } diff --git a/src/os/unix/ngx_solaris_sendfilev_chain.c b/src/os/unix/ngx_solaris_sendfilev_chain.c --- a/src/os/unix/ngx_solaris_sendfilev_chain.c +++ b/src/os/unix/ngx_solaris_sendfilev_chain.c @@ -200,6 +200,7 @@ ngx_solaris_sendfilev_chain(ngx_connecti in = ngx_handle_sent_chain(in, sent); if (eintr) { + send = prev_send + sent; continue; } diff --git a/src/os/unix/ngx_writev_chain.c b/src/os/unix/ngx_writev_chain.c --- a/src/os/unix/ngx_writev_chain.c +++ b/src/os/unix/ngx_writev_chain.c @@ -134,6 +134,7 @@ ngx_writev_chain(ngx_connection_t *c, ng in = ngx_handle_sent_chain(in, sent); if (eintr) { + send = prev_send; continue; }