comparison src/event/ngx_event_connect.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 8b6db3bda591
comparison
equal deleted inserted replaced
9:77eee314ddbd 10:46833bd150cb
11 #include <nginx.h> 11 #include <nginx.h>
12 12
13 13
14 /* AF_INET only */ 14 /* AF_INET only */
15 15
16 int ngx_event_connect_peer(ngx_peer_connection_t *pc) 16 ngx_int_t ngx_event_connect_peer(ngx_peer_connection_t *pc)
17 { 17 {
18 int rc; 18 int rc;
19 ngx_uint_t instance; 19 ngx_uint_t instance;
20 u_int event; 20 u_int event;
21 time_t now; 21 time_t now;
105 } 105 }
106 106
107 /* ngx_unlock_mutex(pc->peers->mutex); */ 107 /* ngx_unlock_mutex(pc->peers->mutex); */
108 108
109 109
110 s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP, 0); 110 s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
111 111
112 if (s == -1) { 112 if (s == -1) {
113 ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno, 113 ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
114 ngx_socket_n " failed"); 114 ngx_socket_n " failed");
115 return NGX_ERROR; 115 return NGX_ERROR;
163 } 163 }
164 164
165 return NGX_ERROR; 165 return NGX_ERROR;
166 } 166 }
167 167
168 #if (WIN32) 168 #if (NGX_WIN32)
169 /* 169 /*
170 * Winsock assignes a socket number divisible by 4 170 * Winsock assignes a socket number divisible by 4
171 * so to find a connection we divide a socket number by 4. 171 * so to find a connection we divide a socket number by 4.
172 */ 172 */
173 173
259 addr.sin_family = AF_INET; 259 addr.sin_family = AF_INET;
260 addr.sin_port = peer->port; 260 addr.sin_port = peer->port;
261 addr.sin_addr.s_addr = peer->addr; 261 addr.sin_addr.s_addr = peer->addr;
262 262
263 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pc->log, 0, 263 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pc->log, 0,
264 "connect to %s, #%d", peer->addr_port_text.data, c->number); 264 "connect to %V, #%d", &peer->addr_port_text, c->number);
265 265
266 rc = connect(s, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)); 266 rc = connect(s, (struct sockaddr *) &addr, sizeof(struct sockaddr_in));
267 267
268 if (rc == -1) { 268 if (rc == -1) {
269 err = ngx_socket_errno; 269 err = ngx_socket_errno;