comparison src/os/win32/ngx_wsasend_chain.c @ 473:8e8f3af115b5 release-0.1.11

nginx-0.1.11-RELEASE import *) Feature: the worker_priority directive. *) Change: both tcp_nopush and tcp_nodelay directives affect the transferred response. *) Bugfix: nginx did not call initgroups(). Thanks to Andrew Sitnikov and Andrei Nigmatulin. *) Change: now the ngx_http_autoindex_module shows the file size in the bytes. *) Bugfix: the ngx_http_autoindex_module returned the 500 error if the broken symlink was in a directory. *) Bugfix: the files bigger than 4G could not be transferred using sendfile. *) Bugfix: if the backend was resolved to several backends and there was an error while the response waiting then process may got caught in an endless loop. *) Bugfix: the worker process may exit with the "unknown cycle" message when the /dev/poll method was used. *) Bugfix: "close() channel failed" errors. *) Bugfix: the autodetection of the "nobody" and "nogroup" groups. *) Bugfix: the send_lowat directive did not work on Linux. *) Bugfix: the segmentation fault occurred if there was no events section in configuration. *) Bugfix: nginx could not be built on OpenBSD. *) Bugfix: the double slashes in "://" in the URI were converted to ":/".
author Igor Sysoev <igor@sysoev.ru>
date Thu, 02 Dec 2004 18:40:46 +0000
parents a88a3e4e158f
children d4ea69372b94
comparison
equal deleted inserted replaced
472:a004b617422d 473:8e8f3af115b5
15 ngx_chain_t *ngx_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in, 15 ngx_chain_t *ngx_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in,
16 off_t limit) 16 off_t limit)
17 { 17 {
18 int rc; 18 int rc;
19 u_char *prev; 19 u_char *prev;
20 u_long size, sent, send, sprev; 20 u_long size, sent, send, prev_send;
21 ngx_uint_t complete; 21 ngx_uint_t complete;
22 ngx_err_t err; 22 ngx_err_t err;
23 ngx_event_t *wev; 23 ngx_event_t *wev;
24 ngx_array_t vec; 24 ngx_array_t vec;
25 LPWSABUF wsabuf; 25 LPWSABUF wsabuf;
30 30
31 if (!wev->ready) { 31 if (!wev->ready) {
32 return in; 32 return in;
33 } 33 }
34 34
35 /* the maximum limit size is the maximum u_long value - the page size */
36
37 if (limit == 0 || limit > NGX_MAX_UINT32_VALUE - ngx_pagesize) {
38 limit = NGX_MAX_UINT32_VALUE - ngx_pagesize;
39 }
40
35 send = 0; 41 send = 0;
36 complete = 0; 42 complete = 0;
37 43
38 /* 44 /*
39 * WSABUFs must be 4-byte aligned otherwise 45 * WSABUFs must be 4-byte aligned otherwise
46 vec.pool = c->pool; 52 vec.pool = c->pool;
47 53
48 for ( ;; ) { 54 for ( ;; ) {
49 prev = NULL; 55 prev = NULL;
50 wsabuf = NULL; 56 wsabuf = NULL;
51 sprev = send; 57 prev_send = send;
52 58
53 vec.nelts = 0; 59 vec.nelts = 0;
54 60
55 /* create the WSABUF and coalesce the neighbouring bufs */ 61 /* create the WSABUF and coalesce the neighbouring bufs */
56 62
103 } 109 }
104 110
105 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, 111 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
106 "WSASend: fd:%d, s:%ul", c->fd, sent); 112 "WSASend: fd:%d, s:%ul", c->fd, sent);
107 113
108 if (send - sprev == sent) { 114 if (send - prev_send == sent) {
109 complete = 1; 115 complete = 1;
110 } 116 }
111 117
112 c->sent += sent; 118 c->sent += sent;
113 119
151 ngx_chain_t *ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in, 157 ngx_chain_t *ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in,
152 off_t limit) 158 off_t limit)
153 { 159 {
154 int rc; 160 int rc;
155 u_char *prev; 161 u_char *prev;
156 size_t size; 162 u_long size, send, sent;
157 u_long send, sent;
158 LPWSABUF wsabuf; 163 LPWSABUF wsabuf;
159 ngx_err_t err; 164 ngx_err_t err;
160 ngx_event_t *wev; 165 ngx_event_t *wev;
161 ngx_array_t vec; 166 ngx_array_t vec;
162 ngx_chain_t *cl; 167 ngx_chain_t *cl;
173 "wev->complete: %d", wev->complete); 178 "wev->complete: %d", wev->complete);
174 179
175 if (!wev->complete) { 180 if (!wev->complete) {
176 181
177 /* post the overlapped WSASend() */ 182 /* post the overlapped WSASend() */
183
184 /* the maximum limit size is the maximum u_long value - the page size */
185
186 if (limit == 0 || limit > NGX_MAX_UINT32_VALUE - ngx_pagesize) {
187 limit = NGX_MAX_UINT32_VALUE - ngx_pagesize;
188 }
178 189
179 /* 190 /*
180 * WSABUFs must be 4-byte aligned otherwise 191 * WSABUFs must be 4-byte aligned otherwise
181 * WSASend() will return undocumented WSAEINVAL error. 192 * WSASend() will return undocumented WSAEINVAL error.
182 */ 193 */