changeset 5868:6bbad2e73245

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.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 27 Aug 2014 20:51:01 +0400
parents 26d28506282a
children fd283aa92e04
files src/os/unix/ngx_darwin_sendfile_chain.c src/os/unix/ngx_freebsd_sendfile_chain.c src/os/unix/ngx_linux_sendfile_chain.c src/os/unix/ngx_solaris_sendfilev_chain.c src/os/unix/ngx_writev_chain.c
diffstat 5 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/unix/ngx_darwin_sendfile_chain.c	Thu Oct 02 22:36:27 2014 +0400
+++ b/src/os/unix/ngx_darwin_sendfile_chain.c	Wed Aug 27 20:51:01 2014 +0400
@@ -308,6 +308,7 @@
         in = ngx_handle_sent_chain(in, sent);
 
         if (eintr) {
+            send = prev_send + sent;
             continue;
         }
 
--- a/src/os/unix/ngx_freebsd_sendfile_chain.c	Thu Oct 02 22:36:27 2014 +0400
+++ b/src/os/unix/ngx_freebsd_sendfile_chain.c	Wed Aug 27 20:51:01 2014 +0400
@@ -378,6 +378,7 @@
         }
 
         if (eintr) {
+            send = prev_send + sent;
             continue;
         }
 
--- a/src/os/unix/ngx_linux_sendfile_chain.c	Thu Oct 02 22:36:27 2014 +0400
+++ b/src/os/unix/ngx_linux_sendfile_chain.c	Wed Aug 27 20:51:01 2014 +0400
@@ -316,6 +316,7 @@
         in = ngx_handle_sent_chain(in, sent);
 
         if (eintr) {
+            send = prev_send;
             continue;
         }
 
--- a/src/os/unix/ngx_solaris_sendfilev_chain.c	Thu Oct 02 22:36:27 2014 +0400
+++ b/src/os/unix/ngx_solaris_sendfilev_chain.c	Wed Aug 27 20:51:01 2014 +0400
@@ -200,6 +200,7 @@
         in = ngx_handle_sent_chain(in, sent);
 
         if (eintr) {
+            send = prev_send + sent;
             continue;
         }
 
--- a/src/os/unix/ngx_writev_chain.c	Thu Oct 02 22:36:27 2014 +0400
+++ b/src/os/unix/ngx_writev_chain.c	Wed Aug 27 20:51:01 2014 +0400
@@ -134,6 +134,7 @@
         in = ngx_handle_sent_chain(in, sent);
 
         if (eintr) {
+            send = prev_send;
             continue;
         }