Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 1166:bde5e4134759
style fix: remove tabs
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 18 Apr 2007 15:21:28 +0000 |
parents | f59d15404269 |
children | 4d0d12446c3b |
comparison
equal
deleted
inserted
replaced
1165:efb7d84db340 | 1166:bde5e4134759 |
---|---|
765 | 765 |
766 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | 766 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
767 "http upstream send request"); | 767 "http upstream send request"); |
768 | 768 |
769 if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK) { | 769 if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK) { |
770 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); | 770 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); |
771 return; | 771 return; |
772 } | 772 } |
773 | 773 |
774 c->log->action = "sending request to upstream"; | 774 c->log->action = "sending request to upstream"; |
775 | 775 |
912 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_TIMEOUT); | 912 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_TIMEOUT); |
913 return; | 913 return; |
914 } | 914 } |
915 | 915 |
916 if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK) { | 916 if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK) { |
917 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); | 917 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); |
918 return; | 918 return; |
919 } | 919 } |
920 | 920 |
921 if (u->buffer.start == NULL) { | 921 if (u->buffer.start == NULL) { |
922 u->buffer.start = ngx_palloc(r->pool, u->conf->buffer_size); | 922 u->buffer.start = ngx_palloc(r->pool, u->conf->buffer_size); |
1257 socklen_t len; | 1257 socklen_t len; |
1258 | 1258 |
1259 #if (NGX_HAVE_KQUEUE) | 1259 #if (NGX_HAVE_KQUEUE) |
1260 | 1260 |
1261 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { | 1261 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { |
1262 if (c->write->pending_eof) { | 1262 if (c->write->pending_eof) { |
1263 (void) ngx_connection_error(c, c->write->kq_errno, | 1263 (void) ngx_connection_error(c, c->write->kq_errno, |
1264 "kevent() reported that connect() failed"); | 1264 "kevent() reported that connect() failed"); |
1265 return NGX_ERROR; | 1265 return NGX_ERROR; |
1266 } | 1266 } |
1267 | 1267 |
1268 } else | 1268 } else |
1269 #endif | 1269 #endif |
1270 { | 1270 { |
1271 err = 0; | 1271 err = 0; |
1272 len = sizeof(int); | 1272 len = sizeof(int); |
1273 | 1273 |
1274 /* | 1274 /* |
1275 * BSDs and Linux return 0 and set a pending error in err | 1275 * BSDs and Linux return 0 and set a pending error in err |
1276 * Solaris returns -1 and sets errno | 1276 * Solaris returns -1 and sets errno |
1277 */ | 1277 */ |
1278 | 1278 |
1279 if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, (void *) &err, &len) | 1279 if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, (void *) &err, &len) |
1280 == -1) | 1280 == -1) |
1281 { | 1281 { |
1282 err = ngx_errno; | 1282 err = ngx_errno; |
1283 } | 1283 } |
1284 | 1284 |
1285 if (err) { | 1285 if (err) { |
1286 (void) ngx_connection_error(c, err, "connect() failed"); | 1286 (void) ngx_connection_error(c, err, "connect() failed"); |
1287 return NGX_ERROR; | 1287 return NGX_ERROR; |
1288 } | 1288 } |
1289 } | 1289 } |
1290 | 1290 |
1291 return NGX_OK; | 1291 return NGX_OK; |
1292 } | 1292 } |
1293 | 1293 |