comparison src/os/unix/ngx_writev_chain.c @ 10:46833bd150cb NGINX_0_1_5

nginx 0.1.5 *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <http://sysoev.ru>
date Thu, 11 Nov 2004 00:00:00 +0300
parents 4b2dafa26fe2
children 6f8b0dc0f8dd
comparison
equal deleted inserted replaced
9:77eee314ddbd 10:46833bd150cb
7 #include <ngx_config.h> 7 #include <ngx_config.h>
8 #include <ngx_core.h> 8 #include <ngx_core.h>
9 #include <ngx_event.h> 9 #include <ngx_event.h>
10 10
11 11
12 #define NGX_IOVS 8 12 #define NGX_IOVS 16
13 13
14 14
15 ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) 15 ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
16 { 16 {
17 u_char *prev; 17 u_char *prev;
18 ssize_t n, size; 18 ssize_t n, size, sent;
19 off_t send, sprev, sent; 19 off_t send, sprev;
20 ngx_uint_t eintr, complete; 20 ngx_uint_t eintr, complete;
21 ngx_err_t err; 21 ngx_err_t err;
22 ngx_array_t vec; 22 ngx_array_t vec;
23 ngx_chain_t *cl; 23 ngx_chain_t *cl;
24 ngx_event_t *wev; 24 ngx_event_t *wev;
64 { 64 {
65 if (ngx_buf_special(cl->buf)) { 65 if (ngx_buf_special(cl->buf)) {
66 continue; 66 continue;
67 } 67 }
68 68
69 #if 1
70 if (!ngx_buf_in_memory(cl->buf)) {
71 ngx_debug_point();
72 }
73 #endif
74
69 size = cl->buf->last - cl->buf->pos; 75 size = cl->buf->last - cl->buf->pos;
70 76
71 if (send + size > limit) { 77 if (send + size > limit) {
72 size = limit - send; 78 size = limit - send;
73 } 79 }
108 } 114 }
109 } 115 }
110 116
111 sent = n > 0 ? n : 0; 117 sent = n > 0 ? n : 0;
112 118
113 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, 119 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "writev: %z", sent);
114 "writev: " OFF_T_FMT, sent);
115 120
116 if (send - sprev == sent) { 121 if (send - sprev == sent) {
117 complete = 1; 122 complete = 1;
118 } 123 }
119 124
120 c->sent += sent; 125 c->sent += sent;
121 126
122 for (cl = in; cl && sent > 0; cl = cl->next) { 127 for (cl = in; cl; cl = cl->next) {
128
123 if (ngx_buf_special(cl->buf)) { 129 if (ngx_buf_special(cl->buf)) {
124 continue; 130 continue;
125 } 131 }
126 132
127 if (sent == 0) { 133 if (sent == 0) {