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.
This commit is contained in:
Valentin Bartenev 2014-08-27 20:51:01 +04:00
parent 70995077ad
commit 840b347bb2
5 changed files with 5 additions and 0 deletions

View File

@ -308,6 +308,7 @@ ngx_darwin_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
in = ngx_handle_sent_chain(in, sent); in = ngx_handle_sent_chain(in, sent);
if (eintr) { if (eintr) {
send = prev_send + sent;
continue; continue;
} }

View File

@ -378,6 +378,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
} }
if (eintr) { if (eintr) {
send = prev_send + sent;
continue; continue;
} }

View File

@ -316,6 +316,7 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
in = ngx_handle_sent_chain(in, sent); in = ngx_handle_sent_chain(in, sent);
if (eintr) { if (eintr) {
send = prev_send;
continue; continue;
} }

View File

@ -200,6 +200,7 @@ ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
in = ngx_handle_sent_chain(in, sent); in = ngx_handle_sent_chain(in, sent);
if (eintr) { if (eintr) {
send = prev_send + sent;
continue; continue;
} }

View File

@ -134,6 +134,7 @@ ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
in = ngx_handle_sent_chain(in, sent); in = ngx_handle_sent_chain(in, sent);
if (eintr) { if (eintr) {
send = prev_send;
continue; continue;
} }