]> git.kaiwu.me - nginx.git/commitdiff
Fixed counting of sent bytes in the send chain functions on EINTR.
authorValentin Bartenev <vbart@nginx.com>
Wed, 27 Aug 2014 16:51:01 +0000 (20:51 +0400)
committerValentin Bartenev <vbart@nginx.com>
Wed, 27 Aug 2014 16:51:01 +0000 (20:51 +0400)
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.

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

index dd574e5ac907325d7dcd23adcb3cb4ecd58df802..8485f9749a5286c209dd49cd1577f36a409c29e1 100644 (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);
 
         if (eintr) {
+            send = prev_send + sent;
             continue;
         }
 
index f5d0f3a8aa19864036bf4b02fcf14ccfef2d9900..88eacc2d11f265e297ae4f650e4ed7c4dd6bd1cd 100644 (file)
@@ -378,6 +378,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
         }
 
         if (eintr) {
+            send = prev_send + sent;
             continue;
         }
 
index 1060852a0cd8f77631f95742e929b498ac50af2a..60867c51e7897b75f374b94d35cc41af46452be6 100644 (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);
 
         if (eintr) {
+            send = prev_send;
             continue;
         }
 
index ba328c810da83bdc5f92d6515507ef1a6a882ca1..1b71f1dd87572f29b5b812736e14fbe8f2b8a03d 100644 (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);
 
         if (eintr) {
+            send = prev_send + sent;
             continue;
         }
 
index 95af2da7a3428f8a60c1abc817ad56be2d100fc7..c7b6ebf7c2222750027e5e0105b61e6e01d6f9ea 100644 (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);
 
         if (eintr) {
+            send = prev_send;
             continue;
         }