nginxtra 1.8.1.12 → 1.10.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/nginxtra +1 -1
- data/bin/nginxtra_rails +1 -1
- data/lib/nginxtra/version.rb +1 -1
- data/vendor/nginx/CHANGES +363 -25
- data/vendor/nginx/CHANGES.ru +365 -21
- data/vendor/nginx/LICENSE +2 -2
- data/vendor/nginx/auto/cc/conf +32 -0
- data/vendor/nginx/auto/cc/gcc +1 -1
- data/vendor/nginx/auto/cc/icc +2 -2
- data/vendor/nginx/auto/cc/msvc +29 -8
- data/vendor/nginx/auto/cc/name +2 -25
- data/vendor/nginx/auto/cc/sunc +3 -0
- data/vendor/nginx/auto/endianness +7 -2
- data/vendor/nginx/auto/install +60 -26
- data/vendor/nginx/auto/lib/conf +4 -4
- data/vendor/nginx/auto/lib/geoip/conf +6 -1
- data/vendor/nginx/auto/lib/libgd/conf +6 -1
- data/vendor/nginx/auto/lib/libxslt/conf +11 -2
- data/vendor/nginx/auto/lib/make +1 -1
- data/vendor/nginx/auto/lib/md5/conf +2 -2
- data/vendor/nginx/auto/lib/md5/make +2 -2
- data/vendor/nginx/auto/lib/openssl/conf +52 -3
- data/vendor/nginx/auto/lib/openssl/make +1 -1
- data/vendor/nginx/auto/lib/pcre/conf +2 -2
- data/vendor/nginx/auto/lib/pcre/make +2 -2
- data/vendor/nginx/auto/lib/perl/conf +6 -3
- data/vendor/nginx/auto/lib/perl/make +4 -1
- data/vendor/nginx/auto/lib/sha1/conf +2 -2
- data/vendor/nginx/auto/lib/sha1/make +2 -2
- data/vendor/nginx/auto/lib/zlib/conf +2 -2
- data/vendor/nginx/auto/lib/zlib/make +2 -2
- data/vendor/nginx/auto/make +281 -16
- data/vendor/nginx/auto/module +122 -0
- data/vendor/nginx/auto/modules +909 -178
- data/vendor/nginx/auto/options +81 -19
- data/vendor/nginx/auto/os/conf +9 -0
- data/vendor/nginx/auto/os/darwin +3 -0
- data/vendor/nginx/auto/os/freebsd +0 -20
- data/vendor/nginx/auto/os/linux +0 -12
- data/vendor/nginx/auto/os/win32 +5 -1
- data/vendor/nginx/auto/sources +11 -311
- data/vendor/nginx/auto/summary +1 -0
- data/vendor/nginx/auto/types/sizeof +5 -3
- data/vendor/nginx/auto/types/typedef +9 -4
- data/vendor/nginx/auto/types/uintptr_t +7 -2
- data/vendor/nginx/auto/unix +72 -12
- data/vendor/nginx/conf/fastcgi.conf +1 -0
- data/vendor/nginx/conf/fastcgi_params +1 -0
- data/vendor/nginx/conf/scgi_params +1 -0
- data/vendor/nginx/conf/uwsgi_params +1 -0
- data/vendor/nginx/configure +1 -1
- data/vendor/nginx/contrib/vim/syntax/nginx.vim +2 -2
- data/vendor/nginx/man/nginx.8 +6 -2
- data/vendor/nginx/src/core/nginx.c +281 -114
- data/vendor/nginx/src/core/nginx.h +2 -2
- data/vendor/nginx/src/core/ngx_conf_file.c +54 -13
- data/vendor/nginx/src/core/ngx_conf_file.h +8 -52
- data/vendor/nginx/src/core/ngx_config.h +0 -5
- data/vendor/nginx/src/core/ngx_connection.c +270 -37
- data/vendor/nginx/src/core/ngx_connection.h +35 -12
- data/vendor/nginx/src/core/ngx_core.h +4 -0
- data/vendor/nginx/src/core/ngx_crypt.c +2 -2
- data/vendor/nginx/src/core/ngx_cycle.c +72 -25
- data/vendor/nginx/src/core/ngx_cycle.h +28 -39
- data/vendor/nginx/src/core/ngx_file.c +14 -5
- data/vendor/nginx/src/core/ngx_file.h +2 -0
- data/vendor/nginx/src/core/ngx_hash.c +13 -1
- data/vendor/nginx/src/core/ngx_inet.c +20 -18
- data/vendor/nginx/src/core/ngx_log.c +12 -12
- data/vendor/nginx/src/core/ngx_log.h +13 -6
- data/vendor/nginx/src/core/ngx_module.c +360 -0
- data/vendor/nginx/src/core/ngx_module.h +307 -0
- data/vendor/nginx/src/core/ngx_open_file_cache.c +2 -2
- data/vendor/nginx/src/core/ngx_output_chain.c +8 -4
- data/vendor/nginx/src/core/ngx_palloc.c +42 -44
- data/vendor/nginx/src/{http/ngx_http_parse_time.c → core/ngx_parse_time.c} +2 -3
- data/vendor/nginx/src/core/ngx_parse_time.h +22 -0
- data/vendor/nginx/src/core/ngx_proxy_protocol.c +50 -1
- data/vendor/nginx/src/core/ngx_proxy_protocol.h +3 -1
- data/vendor/nginx/src/core/ngx_regex.c +1 -38
- data/vendor/nginx/src/core/ngx_resolver.c +1814 -320
- data/vendor/nginx/src/core/ngx_resolver.h +67 -10
- data/vendor/nginx/src/core/ngx_rwlock.c +120 -0
- data/vendor/nginx/src/core/ngx_rwlock.h +21 -0
- data/vendor/nginx/src/core/ngx_slab.c +6 -5
- data/vendor/nginx/src/core/ngx_string.c +1 -1
- data/vendor/nginx/src/core/ngx_syslog.c +11 -3
- data/vendor/nginx/src/core/ngx_syslog.h +2 -1
- data/vendor/nginx/src/core/ngx_thread_pool.c +4 -0
- data/vendor/nginx/src/core/ngx_times.c +2 -2
- data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +3 -1
- data/vendor/nginx/src/event/modules/ngx_epoll_module.c +5 -2
- data/vendor/nginx/src/event/modules/ngx_eventport_module.c +5 -5
- data/vendor/nginx/src/event/modules/ngx_kqueue_module.c +15 -8
- data/vendor/nginx/src/event/modules/ngx_poll_module.c +0 -10
- data/vendor/nginx/src/event/modules/ngx_select_module.c +0 -10
- data/vendor/nginx/src/event/ngx_event.c +60 -103
- data/vendor/nginx/src/event/ngx_event.h +22 -26
- data/vendor/nginx/src/event/ngx_event_accept.c +414 -88
- data/vendor/nginx/src/event/ngx_event_connect.c +27 -18
- data/vendor/nginx/src/event/ngx_event_connect.h +1 -0
- data/vendor/nginx/src/event/ngx_event_openssl.c +65 -25
- data/vendor/nginx/src/event/ngx_event_openssl.h +17 -0
- data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +73 -7
- data/vendor/nginx/src/event/ngx_event_pipe.c +85 -27
- data/vendor/nginx/src/event/ngx_event_pipe.h +10 -0
- data/vendor/nginx/src/http/modules/ngx_http_auth_basic_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_auth_request_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_chunked_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +6 -6
- data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +17 -11
- data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +9 -9
- data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_limit_conn_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +0 -7
- data/vendor/nginx/src/http/modules/ngx_http_map_module.c +6 -6
- data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +2 -1
- data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +13 -13
- data/vendor/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +26 -21
- data/vendor/nginx/src/http/modules/ngx_http_random_index_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_range_filter_module.c +26 -8
- data/vendor/nginx/src/http/modules/ngx_http_realip_module.c +73 -3
- data/vendor/nginx/src/http/modules/ngx_http_referer_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_rewrite_module.c +6 -6
- data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +5 -3
- data/vendor/nginx/src/http/modules/ngx_http_slice_filter_module.c +526 -0
- data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +7 -7
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +19 -16
- data/vendor/nginx/src/http/modules/ngx_http_static_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +373 -173
- data/vendor/nginx/src/http/modules/ngx_http_upstream_hash_module.c +72 -46
- data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +18 -30
- data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +50 -39
- data/vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +38 -129
- data/vendor/nginx/src/http/modules/ngx_http_upstream_zone_module.c +246 -0
- data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +6 -5
- data/vendor/nginx/src/http/modules/perl/nginx.xs +9 -9
- data/vendor/nginx/src/http/ngx_http.c +46 -43
- data/vendor/nginx/src/http/ngx_http.h +4 -9
- data/vendor/nginx/src/http/ngx_http_cache.h +4 -0
- data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +13 -5
- data/vendor/nginx/src/http/ngx_http_core_module.c +92 -91
- data/vendor/nginx/src/http/ngx_http_core_module.h +12 -8
- data/vendor/nginx/src/http/ngx_http_file_cache.c +61 -10
- data/vendor/nginx/src/http/ngx_http_request.c +37 -50
- data/vendor/nginx/src/http/ngx_http_request.h +10 -15
- data/vendor/nginx/src/http/ngx_http_request_body.c +64 -88
- data/vendor/nginx/src/http/ngx_http_script.c +3 -3
- data/vendor/nginx/src/http/ngx_http_special_response.c +1 -4
- data/vendor/nginx/src/http/ngx_http_upstream.c +245 -109
- data/vendor/nginx/src/http/ngx_http_upstream.h +11 -5
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +212 -65
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.h +66 -5
- data/vendor/nginx/src/http/ngx_http_variables.c +28 -15
- data/vendor/nginx/src/http/ngx_http_write_filter_module.c +1 -1
- data/vendor/nginx/src/http/v2/ngx_http_v2.c +4349 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2.h +337 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_filter_module.c +1391 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_huff_decode.c +2714 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_huff_encode.c +254 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_module.c +469 -0
- data/vendor/nginx/src/http/{ngx_http_spdy_module.h → v2/ngx_http_v2_module.h} +10 -9
- data/vendor/nginx/src/http/v2/ngx_http_v2_table.c +349 -0
- data/vendor/nginx/src/mail/ngx_mail.c +49 -82
- data/vendor/nginx/src/mail/ngx_mail.h +16 -23
- data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +1 -1
- data/vendor/nginx/src/mail/ngx_mail_core_module.c +60 -34
- data/vendor/nginx/src/mail/ngx_mail_handler.c +17 -12
- data/vendor/nginx/src/mail/ngx_mail_proxy_module.c +1 -14
- data/vendor/nginx/src/mail/ngx_mail_smtp_handler.c +1 -1
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +5 -5
- data/vendor/nginx/src/os/unix/ngx_atomic.h +10 -10
- data/vendor/nginx/src/os/unix/ngx_channel.h +4 -4
- data/vendor/nginx/src/os/unix/ngx_darwin_config.h +2 -0
- data/vendor/nginx/src/os/unix/ngx_darwin_init.c +1 -0
- data/vendor/nginx/src/os/unix/ngx_dlopen.c +28 -0
- data/vendor/nginx/src/os/unix/ngx_dlopen.h +31 -0
- data/vendor/nginx/src/os/unix/ngx_errno.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_file_aio_read.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_files.c +313 -80
- data/vendor/nginx/src/os/unix/ngx_files.h +5 -2
- data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +3 -1
- data/vendor/nginx/src/os/unix/ngx_freebsd_init.c +1 -0
- data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +13 -0
- data/vendor/nginx/src/os/unix/ngx_linux.h +0 -2
- data/vendor/nginx/src/os/unix/ngx_linux_aio_read.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_linux_config.h +2 -6
- data/vendor/nginx/src/os/unix/ngx_linux_init.c +1 -33
- data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +55 -12
- data/vendor/nginx/src/os/unix/ngx_os.h +3 -9
- data/vendor/nginx/src/os/unix/ngx_posix_config.h +14 -1
- data/vendor/nginx/src/os/unix/ngx_posix_init.c +2 -1
- data/vendor/nginx/src/os/unix/ngx_process.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_process_cycle.c +25 -51
- data/vendor/nginx/src/os/unix/ngx_process_cycle.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_readv_chain.c +24 -28
- data/vendor/nginx/src/os/unix/ngx_recv.c +30 -79
- data/vendor/nginx/src/os/unix/ngx_send.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_setaffinity.c +14 -30
- data/vendor/nginx/src/os/unix/ngx_setaffinity.h +15 -1
- data/vendor/nginx/src/os/unix/ngx_solaris_config.h +2 -0
- data/vendor/nginx/src/os/unix/ngx_solaris_init.c +1 -0
- data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +23 -0
- data/vendor/nginx/src/os/unix/ngx_sunpro_amd64.il +3 -3
- data/vendor/nginx/src/os/unix/ngx_sunpro_x86.il +3 -3
- data/vendor/nginx/src/os/unix/ngx_udp_recv.c +5 -48
- data/vendor/nginx/src/os/unix/ngx_udp_send.c +56 -0
- data/vendor/nginx/src/stream/ngx_stream.c +564 -0
- data/vendor/nginx/src/stream/ngx_stream.h +212 -0
- data/vendor/nginx/src/stream/ngx_stream_access_module.c +451 -0
- data/vendor/nginx/src/stream/ngx_stream_core_module.c +562 -0
- data/vendor/nginx/src/stream/ngx_stream_handler.c +344 -0
- data/vendor/nginx/src/stream/ngx_stream_limit_conn_module.c +632 -0
- data/vendor/nginx/src/stream/ngx_stream_proxy_module.c +1674 -0
- data/vendor/nginx/src/stream/ngx_stream_ssl_module.c +460 -0
- data/vendor/nginx/src/stream/ngx_stream_ssl_module.h +49 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream.c +464 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream.h +107 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_hash_module.c +656 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_least_conn_module.c +307 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_round_robin.c +702 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_round_robin.h +139 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_zone_module.c +242 -0
- metadata +39 -15
- data/vendor/nginx/src/event/modules/ngx_aio_module.c +0 -171
- data/vendor/nginx/src/event/modules/ngx_rtsig_module.c +0 -735
- data/vendor/nginx/src/http/ngx_http_spdy.c +0 -3701
- data/vendor/nginx/src/http/ngx_http_spdy.h +0 -261
- data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +0 -1222
- data/vendor/nginx/src/http/ngx_http_spdy_module.c +0 -408
- data/vendor/nginx/src/os/unix/ngx_aio_read.c +0 -109
- data/vendor/nginx/src/os/unix/ngx_aio_read_chain.c +0 -78
- data/vendor/nginx/src/os/unix/ngx_aio_write.c +0 -109
- data/vendor/nginx/src/os/unix/ngx_aio_write_chain.c +0 -100
@@ -101,12 +101,32 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain, off_t limit)
|
|
101
101
|
}
|
102
102
|
|
103
103
|
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
104
|
-
"readv: %
|
104
|
+
"readv: %ui, last:%uz", vec.nelts, iov->iov_len);
|
105
105
|
|
106
106
|
do {
|
107
107
|
n = readv(c->fd, (struct iovec *) vec.elts, vec.nelts);
|
108
108
|
|
109
|
-
if (n
|
109
|
+
if (n == 0) {
|
110
|
+
rev->ready = 0;
|
111
|
+
rev->eof = 1;
|
112
|
+
|
113
|
+
#if (NGX_HAVE_KQUEUE)
|
114
|
+
|
115
|
+
/*
|
116
|
+
* on FreeBSD readv() may return 0 on closed socket
|
117
|
+
* even if kqueue reported about available data
|
118
|
+
*/
|
119
|
+
|
120
|
+
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
|
121
|
+
rev->available = 0;
|
122
|
+
}
|
123
|
+
|
124
|
+
#endif
|
125
|
+
|
126
|
+
return 0;
|
127
|
+
}
|
128
|
+
|
129
|
+
if (n > 0) {
|
110
130
|
|
111
131
|
#if (NGX_HAVE_KQUEUE)
|
112
132
|
|
@@ -115,7 +135,7 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain, off_t limit)
|
|
115
135
|
|
116
136
|
/*
|
117
137
|
* rev->available may be negative here because some additional
|
118
|
-
* bytes may be received between kevent() and
|
138
|
+
* bytes may be received between kevent() and readv()
|
119
139
|
*/
|
120
140
|
|
121
141
|
if (rev->available <= 0) {
|
@@ -123,42 +143,18 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain, off_t limit)
|
|
123
143
|
rev->ready = 0;
|
124
144
|
}
|
125
145
|
|
126
|
-
if (rev->available < 0) {
|
127
|
-
rev->available = 0;
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
if (n == 0) {
|
132
|
-
|
133
|
-
/*
|
134
|
-
* on FreeBSD recv() may return 0 on closed socket
|
135
|
-
* even if kqueue reported about available data
|
136
|
-
*/
|
137
|
-
|
138
|
-
#if 0
|
139
|
-
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
|
140
|
-
"readv() returned 0 while kevent() reported "
|
141
|
-
"%d available bytes", rev->available);
|
142
|
-
#endif
|
143
|
-
|
144
|
-
rev->ready = 0;
|
145
|
-
rev->eof = 1;
|
146
146
|
rev->available = 0;
|
147
147
|
}
|
148
148
|
|
149
149
|
return n;
|
150
150
|
}
|
151
151
|
|
152
|
-
#endif
|
152
|
+
#endif
|
153
153
|
|
154
154
|
if (n < size && !(ngx_event_flags & NGX_USE_GREEDY_EVENT)) {
|
155
155
|
rev->ready = 0;
|
156
156
|
}
|
157
157
|
|
158
|
-
if (n == 0) {
|
159
|
-
rev->eof = 1;
|
160
|
-
}
|
161
|
-
|
162
158
|
return n;
|
163
159
|
}
|
164
160
|
|
@@ -10,8 +10,6 @@
|
|
10
10
|
#include <ngx_event.h>
|
11
11
|
|
12
12
|
|
13
|
-
#if (NGX_HAVE_KQUEUE)
|
14
|
-
|
15
13
|
ssize_t
|
16
14
|
ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
17
15
|
{
|
@@ -21,6 +19,8 @@ ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
|
21
19
|
|
22
20
|
rev = c->read;
|
23
21
|
|
22
|
+
#if (NGX_HAVE_KQUEUE)
|
23
|
+
|
24
24
|
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
|
25
25
|
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
26
26
|
"recv: eof:%d, avail:%d, err:%d",
|
@@ -48,13 +48,38 @@ ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
|
48
48
|
}
|
49
49
|
}
|
50
50
|
|
51
|
+
#endif
|
52
|
+
|
51
53
|
do {
|
52
54
|
n = recv(c->fd, buf, size, 0);
|
53
55
|
|
54
56
|
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
55
|
-
"recv: fd:%d %
|
57
|
+
"recv: fd:%d %z of %uz", c->fd, n, size);
|
58
|
+
|
59
|
+
if (n == 0) {
|
60
|
+
rev->ready = 0;
|
61
|
+
rev->eof = 1;
|
62
|
+
|
63
|
+
#if (NGX_HAVE_KQUEUE)
|
64
|
+
|
65
|
+
/*
|
66
|
+
* on FreeBSD recv() may return 0 on closed socket
|
67
|
+
* even if kqueue reported about available data
|
68
|
+
*/
|
69
|
+
|
70
|
+
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
|
71
|
+
rev->available = 0;
|
72
|
+
}
|
73
|
+
|
74
|
+
#endif
|
75
|
+
|
76
|
+
return 0;
|
77
|
+
}
|
78
|
+
|
79
|
+
if (n > 0) {
|
80
|
+
|
81
|
+
#if (NGX_HAVE_KQUEUE)
|
56
82
|
|
57
|
-
if (n >= 0) {
|
58
83
|
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
|
59
84
|
rev->available -= n;
|
60
85
|
|
@@ -68,85 +93,13 @@ ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
|
68
93
|
rev->ready = 0;
|
69
94
|
}
|
70
95
|
|
71
|
-
if (rev->available < 0) {
|
72
|
-
rev->available = 0;
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
if (n == 0) {
|
77
|
-
|
78
|
-
/*
|
79
|
-
* on FreeBSD recv() may return 0 on closed socket
|
80
|
-
* even if kqueue reported about available data
|
81
|
-
*/
|
82
|
-
|
83
|
-
rev->ready = 0;
|
84
|
-
rev->eof = 1;
|
85
96
|
rev->available = 0;
|
86
97
|
}
|
87
98
|
|
88
99
|
return n;
|
89
100
|
}
|
90
101
|
|
91
|
-
|
92
|
-
&& !(ngx_event_flags & NGX_USE_GREEDY_EVENT))
|
93
|
-
{
|
94
|
-
rev->ready = 0;
|
95
|
-
}
|
96
|
-
|
97
|
-
if (n == 0) {
|
98
|
-
rev->eof = 1;
|
99
|
-
}
|
100
|
-
|
101
|
-
return n;
|
102
|
-
}
|
103
|
-
|
104
|
-
err = ngx_socket_errno;
|
105
|
-
|
106
|
-
if (err == NGX_EAGAIN || err == NGX_EINTR) {
|
107
|
-
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err,
|
108
|
-
"recv() not ready");
|
109
|
-
n = NGX_AGAIN;
|
110
|
-
|
111
|
-
} else {
|
112
|
-
n = ngx_connection_error(c, err, "recv() failed");
|
113
|
-
break;
|
114
|
-
}
|
115
|
-
|
116
|
-
} while (err == NGX_EINTR);
|
117
|
-
|
118
|
-
rev->ready = 0;
|
119
|
-
|
120
|
-
if (n == NGX_ERROR) {
|
121
|
-
rev->error = 1;
|
122
|
-
}
|
123
|
-
|
124
|
-
return n;
|
125
|
-
}
|
126
|
-
|
127
|
-
#else /* ! NGX_HAVE_KQUEUE */
|
128
|
-
|
129
|
-
ssize_t
|
130
|
-
ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
131
|
-
{
|
132
|
-
ssize_t n;
|
133
|
-
ngx_err_t err;
|
134
|
-
ngx_event_t *rev;
|
135
|
-
|
136
|
-
rev = c->read;
|
137
|
-
|
138
|
-
do {
|
139
|
-
n = recv(c->fd, buf, size, 0);
|
140
|
-
|
141
|
-
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
142
|
-
"recv: fd:%d %d of %d", c->fd, n, size);
|
143
|
-
|
144
|
-
if (n == 0) {
|
145
|
-
rev->ready = 0;
|
146
|
-
rev->eof = 1;
|
147
|
-
return n;
|
148
|
-
|
149
|
-
} else if (n > 0) {
|
102
|
+
#endif
|
150
103
|
|
151
104
|
if ((size_t) n < size
|
152
105
|
&& !(ngx_event_flags & NGX_USE_GREEDY_EVENT))
|
@@ -179,5 +132,3 @@ ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
|
179
132
|
|
180
133
|
return n;
|
181
134
|
}
|
182
|
-
|
183
|
-
#endif /* NGX_HAVE_KQUEUE */
|
@@ -34,7 +34,7 @@ ngx_unix_send(ngx_connection_t *c, u_char *buf, size_t size)
|
|
34
34
|
n = send(c->fd, buf, size, 0);
|
35
35
|
|
36
36
|
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
37
|
-
"send: fd:%d %
|
37
|
+
"send: fd:%d %z of %uz", c->fd, n, size);
|
38
38
|
|
39
39
|
if (n > 0) {
|
40
40
|
if (n < (ssize_t) size) {
|
@@ -10,29 +10,20 @@
|
|
10
10
|
|
11
11
|
#if (NGX_HAVE_CPUSET_SETAFFINITY)
|
12
12
|
|
13
|
-
#include <sys/cpuset.h>
|
14
|
-
|
15
13
|
void
|
16
|
-
ngx_setaffinity(
|
14
|
+
ngx_setaffinity(ngx_cpuset_t *cpu_affinity, ngx_log_t *log)
|
17
15
|
{
|
18
|
-
cpuset_t mask;
|
19
16
|
ngx_uint_t i;
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
i = 0;
|
26
|
-
do {
|
27
|
-
if (cpu_affinity & 1) {
|
28
|
-
CPU_SET(i, &mask);
|
18
|
+
for (i = 0; i < CPU_SETSIZE; i++) {
|
19
|
+
if (CPU_ISSET(i, cpu_affinity)) {
|
20
|
+
ngx_log_error(NGX_LOG_NOTICE, log, 0,
|
21
|
+
"cpuset_setaffinity(): using cpu #%ui", i);
|
29
22
|
}
|
30
|
-
|
31
|
-
cpu_affinity >>= 1;
|
32
|
-
} while (cpu_affinity);
|
23
|
+
}
|
33
24
|
|
34
25
|
if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
|
35
|
-
sizeof(cpuset_t),
|
26
|
+
sizeof(cpuset_t), cpu_affinity) == -1)
|
36
27
|
{
|
37
28
|
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
|
38
29
|
"cpuset_setaffinity() failed");
|
@@ -42,25 +33,18 @@ ngx_setaffinity(uint64_t cpu_affinity, ngx_log_t *log)
|
|
42
33
|
#elif (NGX_HAVE_SCHED_SETAFFINITY)
|
43
34
|
|
44
35
|
void
|
45
|
-
ngx_setaffinity(
|
36
|
+
ngx_setaffinity(ngx_cpuset_t *cpu_affinity, ngx_log_t *log)
|
46
37
|
{
|
47
|
-
cpu_set_t mask;
|
48
38
|
ngx_uint_t i;
|
49
39
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
i = 0;
|
55
|
-
do {
|
56
|
-
if (cpu_affinity & 1) {
|
57
|
-
CPU_SET(i, &mask);
|
40
|
+
for (i = 0; i < CPU_SETSIZE; i++) {
|
41
|
+
if (CPU_ISSET(i, cpu_affinity)) {
|
42
|
+
ngx_log_error(NGX_LOG_NOTICE, log, 0,
|
43
|
+
"sched_setaffinity(): using cpu #%ui", i);
|
58
44
|
}
|
59
|
-
|
60
|
-
cpu_affinity >>= 1;
|
61
|
-
} while (cpu_affinity);
|
45
|
+
}
|
62
46
|
|
63
|
-
if (sched_setaffinity(0, sizeof(cpu_set_t),
|
47
|
+
if (sched_setaffinity(0, sizeof(cpu_set_t), cpu_affinity) == -1) {
|
64
48
|
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
|
65
49
|
"sched_setaffinity() failed");
|
66
50
|
}
|
@@ -11,12 +11,26 @@
|
|
11
11
|
|
12
12
|
#define NGX_HAVE_CPU_AFFINITY 1
|
13
13
|
|
14
|
-
|
14
|
+
#if (NGX_HAVE_SCHED_SETAFFINITY)
|
15
|
+
|
16
|
+
typedef cpu_set_t ngx_cpuset_t;
|
17
|
+
|
18
|
+
#elif (NGX_HAVE_CPUSET_SETAFFINITY)
|
19
|
+
|
20
|
+
#include <sys/cpuset.h>
|
21
|
+
|
22
|
+
typedef cpuset_t ngx_cpuset_t;
|
23
|
+
|
24
|
+
#endif
|
25
|
+
|
26
|
+
void ngx_setaffinity(ngx_cpuset_t *cpu_affinity, ngx_log_t *log);
|
15
27
|
|
16
28
|
#else
|
17
29
|
|
18
30
|
#define ngx_setaffinity(cpu_affinity, log)
|
19
31
|
|
32
|
+
typedef uint64_t ngx_cpuset_t;
|
33
|
+
|
20
34
|
#endif
|
21
35
|
|
22
36
|
|
@@ -48,6 +48,7 @@ ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
48
48
|
ssize_t n;
|
49
49
|
ngx_int_t eintr;
|
50
50
|
ngx_err_t err;
|
51
|
+
ngx_buf_t *file;
|
51
52
|
ngx_uint_t nsfv;
|
52
53
|
sendfilevec_t *sfv, sfvs[NGX_SENDFILEVECS];
|
53
54
|
ngx_event_t *wev;
|
@@ -77,6 +78,7 @@ ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
77
78
|
fd = SFV_FD_SELF;
|
78
79
|
prev = NULL;
|
79
80
|
fprev = 0;
|
81
|
+
file = NULL;
|
80
82
|
sfv = NULL;
|
81
83
|
eintr = 0;
|
82
84
|
sent = 0;
|
@@ -153,6 +155,7 @@ ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
153
155
|
sfv->sfv_len = (size_t) size;
|
154
156
|
}
|
155
157
|
|
158
|
+
file = cl->buf;
|
156
159
|
fprev = cl->buf->file_pos + size;
|
157
160
|
send += size;
|
158
161
|
}
|
@@ -179,6 +182,26 @@ ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
179
182
|
|
180
183
|
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, err,
|
181
184
|
"sendfilev() sent only %uz bytes", sent);
|
185
|
+
|
186
|
+
} else if (n == 0 && sent == 0) {
|
187
|
+
|
188
|
+
/*
|
189
|
+
* sendfilev() is documented to return -1 with errno
|
190
|
+
* set to EINVAL if svf_len is greater than the file size,
|
191
|
+
* but at least Solaris 11 returns 0 instead
|
192
|
+
*/
|
193
|
+
|
194
|
+
if (file) {
|
195
|
+
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
|
196
|
+
"sendfilev() reported that \"%s\" was truncated at %O",
|
197
|
+
file->file->name.data, file->file_pos);
|
198
|
+
|
199
|
+
} else {
|
200
|
+
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
|
201
|
+
"sendfilev() returned 0 with memory buffers");
|
202
|
+
}
|
203
|
+
|
204
|
+
return NGX_CHAIN_ERROR;
|
182
205
|
}
|
183
206
|
|
184
207
|
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
@@ -10,8 +10,6 @@
|
|
10
10
|
#include <ngx_event.h>
|
11
11
|
|
12
12
|
|
13
|
-
#if (NGX_HAVE_KQUEUE)
|
14
|
-
|
15
13
|
ssize_t
|
16
14
|
ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
17
15
|
{
|
@@ -25,9 +23,12 @@ ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
|
25
23
|
n = recv(c->fd, buf, size, 0);
|
26
24
|
|
27
25
|
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
28
|
-
"recv: fd:%d %
|
26
|
+
"recv: fd:%d %z of %uz", c->fd, n, size);
|
29
27
|
|
30
28
|
if (n >= 0) {
|
29
|
+
|
30
|
+
#if (NGX_HAVE_KQUEUE)
|
31
|
+
|
31
32
|
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
|
32
33
|
rev->available -= n;
|
33
34
|
|
@@ -42,50 +43,8 @@ ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
|
42
43
|
}
|
43
44
|
}
|
44
45
|
|
45
|
-
|
46
|
-
}
|
47
|
-
|
48
|
-
err = ngx_socket_errno;
|
49
|
-
|
50
|
-
if (err == NGX_EAGAIN || err == NGX_EINTR) {
|
51
|
-
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err,
|
52
|
-
"recv() not ready");
|
53
|
-
n = NGX_AGAIN;
|
54
|
-
|
55
|
-
} else {
|
56
|
-
n = ngx_connection_error(c, err, "recv() failed");
|
57
|
-
break;
|
58
|
-
}
|
59
|
-
|
60
|
-
} while (err == NGX_EINTR);
|
61
|
-
|
62
|
-
rev->ready = 0;
|
46
|
+
#endif
|
63
47
|
|
64
|
-
if (n == NGX_ERROR) {
|
65
|
-
rev->error = 1;
|
66
|
-
}
|
67
|
-
|
68
|
-
return n;
|
69
|
-
}
|
70
|
-
|
71
|
-
#else /* ! NGX_HAVE_KQUEUE */
|
72
|
-
|
73
|
-
ssize_t
|
74
|
-
ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
75
|
-
{
|
76
|
-
ssize_t n;
|
77
|
-
ngx_err_t err;
|
78
|
-
ngx_event_t *rev;
|
79
|
-
|
80
|
-
rev = c->read;
|
81
|
-
|
82
|
-
do {
|
83
|
-
n = recv(c->fd, buf, size, 0);
|
84
|
-
|
85
|
-
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
86
|
-
"recv: fd:%d %d of %d", c->fd, n, size);
|
87
|
-
|
88
|
-
if (n >= 0) {
|
89
48
|
return n;
|
90
49
|
}
|
91
50
|
|
@@ -111,5 +70,3 @@ ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
|
111
70
|
|
112
71
|
return n;
|
113
72
|
}
|
114
|
-
|
115
|
-
#endif /* NGX_HAVE_KQUEUE */
|