Mercurial > hg > nginx-quic
comparison src/os/win32/ngx_wsarecv.c @ 461:a88a3e4e158f release-0.1.5
nginx-0.1.5-RELEASE import
*) 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 <igor@sysoev.ru> |
---|---|
date | Thu, 11 Nov 2004 14:07:14 +0000 |
parents | 42d11f017717 |
children | e438ec9e736a |
comparison
equal
deleted
inserted
replaced
460:5f8319142dfc | 461:a88a3e4e158f |
---|---|
23 bytes = 0; | 23 bytes = 0; |
24 | 24 |
25 rc = WSARecv(c->fd, wsabuf, 1, &bytes, &flags, NULL, NULL); | 25 rc = WSARecv(c->fd, wsabuf, 1, &bytes, &flags, NULL, NULL); |
26 | 26 |
27 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, | 27 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, |
28 "WSARecv: fd:%d rc:%d %d of %d", c->fd, rc, bytes, size); | 28 "WSARecv: fd:%d rc:%d %ul of %z", c->fd, rc, bytes, size); |
29 | 29 |
30 rev = c->read; | 30 rev = c->read; |
31 | 31 |
32 if (rc == -1) { | 32 if (rc == -1) { |
33 rev->ready = 0; | 33 rev->ready = 0; |
83 if (rev->ovlp.error) { | 83 if (rev->ovlp.error) { |
84 ngx_connection_error(c, rev->ovlp.error, "WSARecv() failed"); | 84 ngx_connection_error(c, rev->ovlp.error, "WSARecv() failed"); |
85 return NGX_ERROR; | 85 return NGX_ERROR; |
86 } | 86 } |
87 | 87 |
88 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
89 "WSARecv ovlp: fd:%d %ul of %z", | |
90 c->fd, rev->available, size); | |
91 | |
88 return rev->available; | 92 return rev->available; |
89 } | 93 } |
90 | 94 |
91 if (WSAGetOverlappedResult(c->fd, (LPWSAOVERLAPPED) &rev->ovlp, | 95 if (WSAGetOverlappedResult(c->fd, (LPWSAOVERLAPPED) &rev->ovlp, |
92 &bytes, 0, NULL) == 0) { | 96 &bytes, 0, NULL) == 0) { |
93 ngx_connection_error(c, ngx_socket_errno, | 97 ngx_connection_error(c, ngx_socket_errno, |
94 "WSARecv() or WSAGetOverlappedResult() failed"); | 98 "WSARecv() or WSAGetOverlappedResult() failed"); |
95 return NGX_ERROR; | 99 return NGX_ERROR; |
96 } | 100 } |
101 | |
102 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, | |
103 "WSARecv: fd:%d %ul of %z", c->fd, bytes, size); | |
97 | 104 |
98 return bytes; | 105 return bytes; |
99 } | 106 } |
100 | 107 |
101 ovlp = (LPWSAOVERLAPPED) &rev->ovlp; | 108 ovlp = (LPWSAOVERLAPPED) &rev->ovlp; |
108 rc = WSARecv(c->fd, wsabuf, 1, &bytes, &flags, ovlp, NULL); | 115 rc = WSARecv(c->fd, wsabuf, 1, &bytes, &flags, ovlp, NULL); |
109 | 116 |
110 rev->complete = 0; | 117 rev->complete = 0; |
111 | 118 |
112 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, | 119 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, |
113 "WSARecv: fd:%d rc:%d %d of %d", c->fd, rc, bytes, size); | 120 "WSARecv ovlp: fd:%d rc:%d %ul of %z", |
121 c->fd, rc, bytes, size); | |
114 | 122 |
115 if (rc == -1) { | 123 if (rc == -1) { |
116 err = ngx_socket_errno; | 124 err = ngx_socket_errno; |
117 if (err == WSA_IO_PENDING) { | 125 if (err == WSA_IO_PENDING) { |
118 rev->active = 1; | 126 rev->active = 1; |
127 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, | |
128 "WSARecv() posted"); | |
119 return NGX_AGAIN; | 129 return NGX_AGAIN; |
120 } | 130 } |
121 | 131 |
122 rev->error = 1; | 132 rev->error = 1; |
123 ngx_connection_error(c, err, "WSARecv() failed"); | 133 ngx_connection_error(c, err, "WSARecv() failed"); |
146 | 156 |
147 rev->active = 0; | 157 rev->active = 0; |
148 | 158 |
149 return bytes; | 159 return bytes; |
150 } | 160 } |
151 | |
152 #if 0 | |
153 | |
154 /* DELELTE IT WHEN ABOVE FUNC WOULD BE TESTED */ | |
155 | |
156 ssize_t ngx_wsarecv(ngx_connection_t *c, char *buf, size_t size) | |
157 { | |
158 int rc; | |
159 u_int flags; | |
160 size_t bytes; | |
161 WSABUF wsabuf[1]; | |
162 ngx_err_t err; | |
163 ngx_event_t *rev; | |
164 LPWSAOVERLAPPED ovlp; | |
165 | |
166 rev = c->read; | |
167 bytes = 0; | |
168 | |
169 if ((ngx_event_flags & NGX_USE_AIO_EVENT) && rev->ready) { | |
170 rev->ready = 0; | |
171 | |
172 /* the overlapped WSARecv() completed */ | |
173 | |
174 if (ngx_event_flags & NGX_USE_IOCP_EVENT) { | |
175 if (rev->ovlp.error) { | |
176 ngx_log_error(NGX_LOG_ERR, c->log, rev->ovlp.error, | |
177 "WSARecv() failed"); | |
178 return NGX_ERROR; | |
179 } | |
180 | |
181 return rev->available; | |
182 } | |
183 | |
184 if (WSAGetOverlappedResult(c->fd, (LPWSAOVERLAPPED) &rev->ovlp, | |
185 &bytes, 0, NULL) == 0) { | |
186 err = ngx_socket_errno; | |
187 ngx_log_error(NGX_LOG_CRIT, c->log, err, | |
188 "WSARecv() or WSAGetOverlappedResult() failed"); | |
189 | |
190 return NGX_ERROR; | |
191 } | |
192 | |
193 return bytes; | |
194 } | |
195 | |
196 if (ngx_event_flags & NGX_USE_AIO_EVENT) { | |
197 ovlp = (LPWSAOVERLAPPED) &c->read->ovlp; | |
198 ngx_memzero(ovlp, sizeof(WSAOVERLAPPED)); | |
199 | |
200 } else { | |
201 ovlp = NULL; | |
202 } | |
203 | |
204 wsabuf[0].buf = buf; | |
205 wsabuf[0].len = size; | |
206 flags = 0; | |
207 | |
208 rc = WSARecv(c->fd, wsabuf, 1, &bytes, &flags, ovlp, NULL); | |
209 | |
210 ngx_log_debug(c->log, "WSARecv: %d:%d" _ rc _ bytes); | |
211 | |
212 if (rc == -1) { | |
213 err = ngx_socket_errno; | |
214 if (err == WSA_IO_PENDING) { | |
215 return NGX_AGAIN; | |
216 | |
217 } else if (err == WSAEWOULDBLOCK) { | |
218 ngx_log_error(NGX_LOG_INFO, c->log, err, "WSARecv() EAGAIN"); | |
219 return NGX_AGAIN; | |
220 | |
221 } else { | |
222 ngx_log_error(NGX_LOG_CRIT, c->log, err, "WSARecv() failed"); | |
223 return NGX_ERROR; | |
224 } | |
225 } | |
226 | |
227 if (ngx_event_flags & NGX_USE_IOCP_EVENT) { | |
228 | |
229 /* | |
230 * If a socket was bound with I/O completion port | |
231 * then GetQueuedCompletionStatus() would anyway return its status | |
232 * despite that WSARecv() was already completed. | |
233 */ | |
234 | |
235 return NGX_AGAIN; | |
236 } | |
237 | |
238 return bytes; | |
239 } | |
240 | |
241 #endif |