nginxtra 1.6.3.9 → 1.8.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/bin/nginxtra +1 -1
  3. data/bin/nginxtra_rails +1 -1
  4. data/lib/nginxtra/version.rb +1 -1
  5. data/vendor/nginx/CHANGES +358 -14
  6. data/vendor/nginx/CHANGES.ru +372 -18
  7. data/vendor/nginx/LICENSE +2 -2
  8. data/vendor/nginx/auto/cc/clang +5 -0
  9. data/vendor/nginx/auto/cc/gcc +5 -0
  10. data/vendor/nginx/auto/lib/google-perftools/conf +1 -1
  11. data/vendor/nginx/auto/lib/openssl/make +0 -5
  12. data/vendor/nginx/auto/lib/perl/conf +9 -1
  13. data/vendor/nginx/auto/make +1 -1
  14. data/vendor/nginx/auto/modules +11 -0
  15. data/vendor/nginx/auto/options +10 -2
  16. data/vendor/nginx/auto/os/darwin +0 -1
  17. data/vendor/nginx/auto/os/freebsd +6 -23
  18. data/vendor/nginx/auto/sources +16 -14
  19. data/vendor/nginx/auto/summary +3 -24
  20. data/vendor/nginx/auto/threads +20 -0
  21. data/vendor/nginx/auto/types/sizeof +2 -12
  22. data/vendor/nginx/auto/unix +50 -6
  23. data/vendor/nginx/configure +5 -0
  24. data/vendor/nginx/contrib/vim/syntax/nginx.vim +183 -50
  25. data/vendor/nginx/src/core/nginx.c +21 -9
  26. data/vendor/nginx/src/core/nginx.h +8 -2
  27. data/vendor/nginx/src/core/ngx_buf.c +88 -0
  28. data/vendor/nginx/src/core/ngx_buf.h +15 -1
  29. data/vendor/nginx/src/core/ngx_conf_file.c +4 -1
  30. data/vendor/nginx/src/core/ngx_connection.c +25 -66
  31. data/vendor/nginx/src/core/ngx_connection.h +1 -3
  32. data/vendor/nginx/src/core/ngx_core.h +11 -3
  33. data/vendor/nginx/src/core/ngx_crypt.c +1 -1
  34. data/vendor/nginx/src/core/ngx_cycle.c +7 -1
  35. data/vendor/nginx/src/core/ngx_cycle.h +6 -2
  36. data/vendor/nginx/src/core/ngx_file.c +13 -5
  37. data/vendor/nginx/src/core/ngx_file.h +6 -0
  38. data/vendor/nginx/src/core/ngx_log.c +215 -21
  39. data/vendor/nginx/src/core/ngx_log.h +9 -1
  40. data/vendor/nginx/src/core/ngx_output_chain.c +104 -15
  41. data/vendor/nginx/src/core/ngx_palloc.c +3 -7
  42. data/vendor/nginx/src/core/ngx_rbtree.c +2 -4
  43. data/vendor/nginx/src/core/ngx_rbtree.h +2 -4
  44. data/vendor/nginx/src/core/ngx_regex.c +14 -6
  45. data/vendor/nginx/src/core/ngx_resolver.c +16 -23
  46. data/vendor/nginx/src/core/ngx_resolver.h +8 -7
  47. data/vendor/nginx/src/core/ngx_shmtx.c +1 -1
  48. data/vendor/nginx/src/core/ngx_slab.c +89 -2
  49. data/vendor/nginx/src/core/ngx_slab.h +3 -0
  50. data/vendor/nginx/src/core/ngx_string.c +58 -2
  51. data/vendor/nginx/src/core/ngx_string.h +1 -0
  52. data/vendor/nginx/src/core/ngx_syslog.c +374 -0
  53. data/vendor/nginx/src/core/ngx_syslog.h +30 -0
  54. data/vendor/nginx/src/core/ngx_thread_pool.c +630 -0
  55. data/vendor/nginx/src/core/ngx_thread_pool.h +36 -0
  56. data/vendor/nginx/src/core/ngx_times.c +19 -2
  57. data/vendor/nginx/src/core/ngx_times.h +1 -0
  58. data/vendor/nginx/src/event/modules/ngx_aio_module.c +1 -1
  59. data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +9 -24
  60. data/vendor/nginx/src/event/modules/ngx_epoll_module.c +152 -28
  61. data/vendor/nginx/src/event/modules/ngx_eventport_module.c +43 -25
  62. data/vendor/nginx/src/event/modules/ngx_kqueue_module.c +86 -156
  63. data/vendor/nginx/src/event/modules/ngx_poll_module.c +21 -37
  64. data/vendor/nginx/src/event/modules/ngx_rtsig_module.c +15 -27
  65. data/vendor/nginx/src/event/modules/ngx_select_module.c +10 -12
  66. data/vendor/nginx/src/event/modules/ngx_win32_select_module.c +7 -9
  67. data/vendor/nginx/src/event/ngx_event.c +5 -33
  68. data/vendor/nginx/src/event/ngx_event.h +15 -50
  69. data/vendor/nginx/src/event/ngx_event_accept.c +11 -10
  70. data/vendor/nginx/src/event/ngx_event_connect.c +0 -11
  71. data/vendor/nginx/src/event/ngx_event_connect.h +1 -4
  72. data/vendor/nginx/src/event/ngx_event_openssl.c +622 -38
  73. data/vendor/nginx/src/event/ngx_event_openssl.h +20 -2
  74. data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +5 -1
  75. data/vendor/nginx/src/event/ngx_event_pipe.c +45 -19
  76. data/vendor/nginx/src/event/ngx_event_pipe.h +3 -0
  77. data/vendor/nginx/src/event/ngx_event_posted.c +7 -145
  78. data/vendor/nginx/src/event/ngx_event_posted.h +12 -39
  79. data/vendor/nginx/src/event/ngx_event_timer.c +50 -70
  80. data/vendor/nginx/src/event/ngx_event_timer.h +2 -14
  81. data/vendor/nginx/src/http/modules/ngx_http_addition_filter_module.c +1 -1
  82. data/vendor/nginx/src/http/modules/ngx_http_autoindex_module.c +416 -71
  83. data/vendor/nginx/src/http/modules/ngx_http_charset_filter_module.c +19 -15
  84. data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +16 -4
  85. data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +601 -134
  86. data/vendor/nginx/src/http/modules/ngx_http_geo_module.c +1 -1
  87. data/vendor/nginx/src/http/modules/ngx_http_geoip_module.c +9 -3
  88. data/vendor/nginx/src/http/modules/ngx_http_gunzip_filter_module.c +9 -3
  89. data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +9 -3
  90. data/vendor/nginx/src/http/modules/ngx_http_gzip_static_module.c +0 -2
  91. data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +197 -91
  92. data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +1 -0
  93. data/vendor/nginx/src/http/modules/ngx_http_limit_conn_module.c +65 -162
  94. data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +53 -67
  95. data/vendor/nginx/src/http/modules/ngx_http_log_module.c +128 -23
  96. data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +25 -6
  97. data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +1 -1
  98. data/vendor/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +39 -13
  99. data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +697 -141
  100. data/vendor/nginx/src/http/modules/ngx_http_rewrite_module.c +5 -1
  101. data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +282 -125
  102. data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +4 -1
  103. data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +44 -1
  104. data/vendor/nginx/src/http/modules/ngx_http_ssl_module.h +2 -0
  105. data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +10 -8
  106. data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +18 -3
  107. data/vendor/nginx/src/http/modules/ngx_http_upstream_hash_module.c +641 -0
  108. data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +1 -1
  109. data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +3 -21
  110. data/vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +0 -5
  111. data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +449 -125
  112. data/vendor/nginx/src/http/modules/ngx_http_xslt_filter_module.c +4 -2
  113. data/vendor/nginx/src/http/modules/perl/ngx_http_perl_module.c +2 -1
  114. data/vendor/nginx/src/http/ngx_http.c +10 -5
  115. data/vendor/nginx/src/http/ngx_http.h +4 -4
  116. data/vendor/nginx/src/http/ngx_http_cache.h +26 -1
  117. data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +109 -68
  118. data/vendor/nginx/src/http/ngx_http_core_module.c +191 -46
  119. data/vendor/nginx/src/http/ngx_http_core_module.h +16 -4
  120. data/vendor/nginx/src/http/ngx_http_file_cache.c +584 -67
  121. data/vendor/nginx/src/http/ngx_http_parse.c +55 -4
  122. data/vendor/nginx/src/http/ngx_http_request.c +14 -6
  123. data/vendor/nginx/src/http/ngx_http_request.h +12 -4
  124. data/vendor/nginx/src/http/ngx_http_request_body.c +114 -28
  125. data/vendor/nginx/src/http/ngx_http_spdy.c +383 -229
  126. data/vendor/nginx/src/http/ngx_http_spdy.h +8 -5
  127. data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +12 -4
  128. data/vendor/nginx/src/http/ngx_http_special_response.c +2 -2
  129. data/vendor/nginx/src/http/ngx_http_upstream.c +808 -132
  130. data/vendor/nginx/src/http/ngx_http_upstream.h +33 -3
  131. data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +72 -65
  132. data/vendor/nginx/src/http/ngx_http_upstream_round_robin.h +1 -2
  133. data/vendor/nginx/src/http/ngx_http_variables.c +47 -3
  134. data/vendor/nginx/src/http/ngx_http_write_filter_module.c +15 -6
  135. data/vendor/nginx/src/mail/ngx_mail.c +2 -3
  136. data/vendor/nginx/src/mail/ngx_mail.h +2 -0
  137. data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +140 -11
  138. data/vendor/nginx/src/mail/ngx_mail_core_module.c +3 -3
  139. data/vendor/nginx/src/mail/ngx_mail_handler.c +79 -2
  140. data/vendor/nginx/src/mail/ngx_mail_imap_module.c +3 -1
  141. data/vendor/nginx/src/mail/ngx_mail_pop3_module.c +3 -1
  142. data/vendor/nginx/src/mail/ngx_mail_smtp_module.c +3 -1
  143. data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +125 -1
  144. data/vendor/nginx/src/mail/ngx_mail_ssl_module.h +8 -0
  145. data/vendor/nginx/src/misc/ngx_cpp_test_module.cpp +1 -1
  146. data/vendor/nginx/src/os/unix/ngx_aio_read_chain.c +1 -1
  147. data/vendor/nginx/src/os/unix/ngx_channel.c +0 -7
  148. data/vendor/nginx/src/os/unix/ngx_darwin_config.h +0 -3
  149. data/vendor/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +44 -208
  150. data/vendor/nginx/src/os/unix/ngx_file_aio_read.c +25 -17
  151. data/vendor/nginx/src/os/unix/ngx_files.c +109 -0
  152. data/vendor/nginx/src/os/unix/ngx_files.h +6 -0
  153. data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +0 -6
  154. data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +78 -206
  155. data/vendor/nginx/src/os/unix/ngx_linux_aio_read.c +25 -14
  156. data/vendor/nginx/src/os/unix/ngx_linux_config.h +4 -1
  157. data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +235 -194
  158. data/vendor/nginx/src/os/unix/ngx_os.h +25 -3
  159. data/vendor/nginx/src/os/unix/ngx_posix_init.c +4 -2
  160. data/vendor/nginx/src/os/unix/ngx_process_cycle.c +13 -195
  161. data/vendor/nginx/src/os/unix/ngx_process_cycle.h +0 -1
  162. data/vendor/nginx/src/os/unix/ngx_readv_chain.c +27 -108
  163. data/vendor/nginx/src/os/unix/ngx_setproctitle.h +2 -2
  164. data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +12 -67
  165. data/vendor/nginx/src/os/unix/ngx_thread.h +26 -83
  166. data/vendor/nginx/src/os/unix/ngx_thread_cond.c +87 -0
  167. data/vendor/nginx/src/os/unix/ngx_thread_id.c +70 -0
  168. data/vendor/nginx/src/os/unix/ngx_thread_mutex.c +174 -0
  169. data/vendor/nginx/src/os/unix/ngx_user.c +2 -20
  170. data/vendor/nginx/src/os/unix/ngx_writev_chain.c +129 -98
  171. metadata +16 -17
  172. data/vendor/nginx/auto/lib/zlib/patch.zlib.h +0 -10
  173. data/vendor/nginx/src/event/ngx_event_busy_lock.c +0 -286
  174. data/vendor/nginx/src/event/ngx_event_busy_lock.h +0 -65
  175. data/vendor/nginx/src/event/ngx_event_mutex.c +0 -70
  176. data/vendor/nginx/src/http/ngx_http_busy_lock.c +0 -307
  177. data/vendor/nginx/src/http/ngx_http_busy_lock.h +0 -54
  178. data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +0 -756
  179. data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +0 -122
  180. data/vendor/nginx/src/os/unix/ngx_pthread_thread.c +0 -278
  181. data/vendor/nginx/src/os/unix/rfork_thread.S +0 -73
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nginxtra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3.9
4
+ version: 1.8.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Virata-Stone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-09 00:00:00.000000000 Z
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.16'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.16'
27
27
  description: This gem is intended to provide an easy to use configuration file that
@@ -117,7 +117,6 @@ files:
117
117
  - vendor/nginx/auto/lib/zlib/makefile.bcc
118
118
  - vendor/nginx/auto/lib/zlib/makefile.msvc
119
119
  - vendor/nginx/auto/lib/zlib/makefile.owc
120
- - vendor/nginx/auto/lib/zlib/patch.zlib.h
121
120
  - vendor/nginx/auto/make
122
121
  - vendor/nginx/auto/modules
123
122
  - vendor/nginx/auto/nohave
@@ -131,6 +130,7 @@ files:
131
130
  - vendor/nginx/auto/sources
132
131
  - vendor/nginx/auto/stubs
133
132
  - vendor/nginx/auto/summary
133
+ - vendor/nginx/auto/threads
134
134
  - vendor/nginx/auto/types/sizeof
135
135
  - vendor/nginx/auto/types/typedef
136
136
  - vendor/nginx/auto/types/uintptr_t
@@ -218,6 +218,10 @@ files:
218
218
  - vendor/nginx/src/core/ngx_spinlock.c
219
219
  - vendor/nginx/src/core/ngx_string.c
220
220
  - vendor/nginx/src/core/ngx_string.h
221
+ - vendor/nginx/src/core/ngx_syslog.c
222
+ - vendor/nginx/src/core/ngx_syslog.h
223
+ - vendor/nginx/src/core/ngx_thread_pool.c
224
+ - vendor/nginx/src/core/ngx_thread_pool.h
221
225
  - vendor/nginx/src/core/ngx_times.c
222
226
  - vendor/nginx/src/core/ngx_times.h
223
227
  - vendor/nginx/src/event/modules/ngx_aio_module.c
@@ -232,11 +236,8 @@ files:
232
236
  - vendor/nginx/src/event/ngx_event.c
233
237
  - vendor/nginx/src/event/ngx_event.h
234
238
  - vendor/nginx/src/event/ngx_event_accept.c
235
- - vendor/nginx/src/event/ngx_event_busy_lock.c
236
- - vendor/nginx/src/event/ngx_event_busy_lock.h
237
239
  - vendor/nginx/src/event/ngx_event_connect.c
238
240
  - vendor/nginx/src/event/ngx_event_connect.h
239
- - vendor/nginx/src/event/ngx_event_mutex.c
240
241
  - vendor/nginx/src/event/ngx_event_openssl.c
241
242
  - vendor/nginx/src/event/ngx_event_openssl.h
242
243
  - vendor/nginx/src/event/ngx_event_openssl_stapling.c
@@ -290,6 +291,7 @@ files:
290
291
  - vendor/nginx/src/http/modules/ngx_http_static_module.c
291
292
  - vendor/nginx/src/http/modules/ngx_http_stub_status_module.c
292
293
  - vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c
294
+ - vendor/nginx/src/http/modules/ngx_http_upstream_hash_module.c
293
295
  - vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c
294
296
  - vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c
295
297
  - vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c
@@ -304,8 +306,6 @@ files:
304
306
  - vendor/nginx/src/http/modules/perl/typemap
305
307
  - vendor/nginx/src/http/ngx_http.c
306
308
  - vendor/nginx/src/http/ngx_http.h
307
- - vendor/nginx/src/http/ngx_http_busy_lock.c
308
- - vendor/nginx/src/http/ngx_http_busy_lock.h
309
309
  - vendor/nginx/src/http/ngx_http_cache.h
310
310
  - vendor/nginx/src/http/ngx_http_config.h
311
311
  - vendor/nginx/src/http/ngx_http_copy_filter_module.c
@@ -376,8 +376,6 @@ files:
376
376
  - vendor/nginx/src/os/unix/ngx_freebsd.h
377
377
  - vendor/nginx/src/os/unix/ngx_freebsd_config.h
378
378
  - vendor/nginx/src/os/unix/ngx_freebsd_init.c
379
- - vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.c
380
- - vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.h
381
379
  - vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c
382
380
  - vendor/nginx/src/os/unix/ngx_gcc_atomic_amd64.h
383
381
  - vendor/nginx/src/os/unix/ngx_gcc_atomic_ppc.h
@@ -395,7 +393,6 @@ files:
395
393
  - vendor/nginx/src/os/unix/ngx_process.h
396
394
  - vendor/nginx/src/os/unix/ngx_process_cycle.c
397
395
  - vendor/nginx/src/os/unix/ngx_process_cycle.h
398
- - vendor/nginx/src/os/unix/ngx_pthread_thread.c
399
396
  - vendor/nginx/src/os/unix/ngx_readv_chain.c
400
397
  - vendor/nginx/src/os/unix/ngx_recv.c
401
398
  - vendor/nginx/src/os/unix/ngx_send.c
@@ -416,13 +413,15 @@ files:
416
413
  - vendor/nginx/src/os/unix/ngx_sunpro_sparc64.il
417
414
  - vendor/nginx/src/os/unix/ngx_sunpro_x86.il
418
415
  - vendor/nginx/src/os/unix/ngx_thread.h
416
+ - vendor/nginx/src/os/unix/ngx_thread_cond.c
417
+ - vendor/nginx/src/os/unix/ngx_thread_id.c
418
+ - vendor/nginx/src/os/unix/ngx_thread_mutex.c
419
419
  - vendor/nginx/src/os/unix/ngx_time.c
420
420
  - vendor/nginx/src/os/unix/ngx_time.h
421
421
  - vendor/nginx/src/os/unix/ngx_udp_recv.c
422
422
  - vendor/nginx/src/os/unix/ngx_user.c
423
423
  - vendor/nginx/src/os/unix/ngx_user.h
424
424
  - vendor/nginx/src/os/unix/ngx_writev_chain.c
425
- - vendor/nginx/src/os/unix/rfork_thread.S
426
425
  homepage: https://github.com/mikestone/nginxtra
427
426
  licenses:
428
427
  - nginx
@@ -433,17 +432,17 @@ require_paths:
433
432
  - lib
434
433
  required_ruby_version: !ruby/object:Gem::Requirement
435
434
  requirements:
436
- - - '>='
435
+ - - ">="
437
436
  - !ruby/object:Gem::Version
438
437
  version: '0'
439
438
  required_rubygems_version: !ruby/object:Gem::Requirement
440
439
  requirements:
441
- - - '>='
440
+ - - ">="
442
441
  - !ruby/object:Gem::Version
443
442
  version: '0'
444
443
  requirements: []
445
444
  rubyforge_project:
446
- rubygems_version: 2.0.3
445
+ rubygems_version: 2.4.4
447
446
  signing_key:
448
447
  specification_version: 4
449
448
  summary: Wrapper of nginx for easy install and use.
@@ -1,10 +0,0 @@
1
- --- zlib.h Thu Jul 9 20:06:56 1998
2
- +++ zlib-1.1.3/zlib.h Tue Mar 22 13:41:04 2005
3
- @@ -709,7 +709,6 @@
4
- (0 in case of error).
5
- */
6
-
7
- -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
8
- /*
9
- Converts, formats, and writes the args to the compressed file under
10
- control of the format string, as in fprintf. gzprintf returns the number of
@@ -1,286 +0,0 @@
1
-
2
- /*
3
- * Copyright (C) Igor Sysoev
4
- * Copyright (C) Nginx, Inc.
5
- */
6
-
7
-
8
- #include <ngx_config.h>
9
- #include <ngx_core.h>
10
- #include <ngx_event.h>
11
-
12
-
13
- static ngx_int_t ngx_event_busy_lock_look_cacheable(ngx_event_busy_lock_t *bl,
14
- ngx_event_busy_lock_ctx_t *ctx);
15
- static void ngx_event_busy_lock_handler(ngx_event_t *ev);
16
- static void ngx_event_busy_lock_posted_handler(ngx_event_t *ev);
17
-
18
-
19
- /*
20
- * NGX_OK: the busy lock is held
21
- * NGX_AGAIN: the all busy locks are held but we will wait the specified time
22
- * NGX_BUSY: ctx->timer == 0: there are many the busy locks
23
- * ctx->timer != 0: there are many the waiting locks
24
- */
25
-
26
- ngx_int_t
27
- ngx_event_busy_lock(ngx_event_busy_lock_t *bl, ngx_event_busy_lock_ctx_t *ctx)
28
- {
29
- ngx_int_t rc;
30
-
31
- ngx_mutex_lock(bl->mutex);
32
-
33
- ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ctx->event->log, 0,
34
- "event busy lock: b:%d mb:%d",
35
- bl->busy, bl->max_busy);
36
-
37
- if (bl->busy < bl->max_busy) {
38
- bl->busy++;
39
-
40
- rc = NGX_OK;
41
-
42
- } else if (ctx->timer && bl->waiting < bl->max_waiting) {
43
- bl->waiting++;
44
- ngx_add_timer(ctx->event, ctx->timer);
45
- ctx->event->handler = ngx_event_busy_lock_handler;
46
-
47
- if (bl->events) {
48
- bl->last->next = ctx;
49
-
50
- } else {
51
- bl->events = ctx;
52
- }
53
-
54
- bl->last = ctx;
55
-
56
- rc = NGX_AGAIN;
57
-
58
- } else {
59
- rc = NGX_BUSY;
60
- }
61
-
62
- ngx_mutex_unlock(bl->mutex);
63
-
64
- return rc;
65
- }
66
-
67
-
68
- ngx_int_t
69
- ngx_event_busy_lock_cacheable(ngx_event_busy_lock_t *bl,
70
- ngx_event_busy_lock_ctx_t *ctx)
71
- {
72
- ngx_int_t rc;
73
-
74
- ngx_mutex_lock(bl->mutex);
75
-
76
- rc = ngx_event_busy_lock_look_cacheable(bl, ctx);
77
-
78
- ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ctx->event->log, 0,
79
- "event busy lock: %d w:%d mw:%d",
80
- rc, bl->waiting, bl->max_waiting);
81
-
82
- /*
83
- * NGX_OK: no the same request, there is free slot and we locked it
84
- * NGX_BUSY: no the same request and there is no free slot
85
- * NGX_AGAIN: the same request is processing
86
- */
87
-
88
- if (rc == NGX_AGAIN) {
89
-
90
- if (ctx->timer && bl->waiting < bl->max_waiting) {
91
- bl->waiting++;
92
- ngx_add_timer(ctx->event, ctx->timer);
93
- ctx->event->handler = ngx_event_busy_lock_handler;
94
-
95
- if (bl->events == NULL) {
96
- bl->events = ctx;
97
- } else {
98
- bl->last->next = ctx;
99
- }
100
- bl->last = ctx;
101
-
102
- } else {
103
- rc = NGX_BUSY;
104
- }
105
- }
106
-
107
- ngx_mutex_unlock(bl->mutex);
108
-
109
- return rc;
110
- }
111
-
112
-
113
- void
114
- ngx_event_busy_unlock(ngx_event_busy_lock_t *bl,
115
- ngx_event_busy_lock_ctx_t *ctx)
116
- {
117
- ngx_event_t *ev;
118
- ngx_event_busy_lock_ctx_t *wakeup;
119
-
120
- ngx_mutex_lock(bl->mutex);
121
-
122
- if (bl->events) {
123
- wakeup = bl->events;
124
- bl->events = bl->events->next;
125
-
126
- } else {
127
- wakeup = NULL;
128
- bl->busy--;
129
- }
130
-
131
- /*
132
- * MP: all ctx's and their queue must be in shared memory,
133
- * each ctx has pid to wake up
134
- */
135
-
136
- if (wakeup == NULL) {
137
- ngx_mutex_unlock(bl->mutex);
138
- return;
139
- }
140
-
141
- if (ctx->md5) {
142
- for (wakeup = bl->events; wakeup; wakeup = wakeup->next) {
143
- if (wakeup->md5 == NULL || wakeup->slot != ctx->slot) {
144
- continue;
145
- }
146
-
147
- wakeup->handler = ngx_event_busy_lock_posted_handler;
148
- wakeup->cache_updated = 1;
149
-
150
- ev = wakeup->event;
151
-
152
- ngx_post_event(ev, &ngx_posted_events);
153
- }
154
-
155
- ngx_mutex_unlock(bl->mutex);
156
-
157
- } else {
158
- bl->waiting--;
159
-
160
- ngx_mutex_unlock(bl->mutex);
161
-
162
- wakeup->handler = ngx_event_busy_lock_posted_handler;
163
- wakeup->locked = 1;
164
-
165
- ev = wakeup->event;
166
-
167
- if (ev->timer_set) {
168
- ngx_del_timer(ev);
169
- }
170
-
171
- ngx_post_event(ev, &ngx_posted_events);
172
- }
173
- }
174
-
175
-
176
- void
177
- ngx_event_busy_lock_cancel(ngx_event_busy_lock_t *bl,
178
- ngx_event_busy_lock_ctx_t *ctx)
179
- {
180
- ngx_event_busy_lock_ctx_t *c, *p;
181
-
182
- ngx_mutex_lock(bl->mutex);
183
-
184
- bl->waiting--;
185
-
186
- if (ctx == bl->events) {
187
- bl->events = ctx->next;
188
-
189
- } else {
190
- p = bl->events;
191
- for (c = bl->events->next; c; c = c->next) {
192
- if (c == ctx) {
193
- p->next = ctx->next;
194
- break;
195
- }
196
- p = c;
197
- }
198
- }
199
-
200
- ngx_mutex_unlock(bl->mutex);
201
- }
202
-
203
-
204
- static ngx_int_t
205
- ngx_event_busy_lock_look_cacheable(ngx_event_busy_lock_t *bl,
206
- ngx_event_busy_lock_ctx_t *ctx)
207
- {
208
- ngx_int_t free;
209
- ngx_uint_t i, bit, cacheable, mask;
210
-
211
- bit = 0;
212
- cacheable = 0;
213
- free = -1;
214
-
215
- #if (NGX_SUPPRESS_WARN)
216
- mask = 0;
217
- #endif
218
-
219
- for (i = 0; i < bl->max_busy; i++) {
220
-
221
- if ((bit & 7) == 0) {
222
- mask = bl->md5_mask[i / 8];
223
- }
224
-
225
- if (mask & 1) {
226
- if (ngx_memcmp(&bl->md5[i * 16], ctx->md5, 16) == 0) {
227
- ctx->waiting = 1;
228
- ctx->slot = i;
229
- return NGX_AGAIN;
230
- }
231
- cacheable++;
232
-
233
- } else if (free == -1) {
234
- free = i;
235
- }
236
-
237
- if (cacheable == bl->cacheable) {
238
- if (free == -1 && cacheable < bl->max_busy) {
239
- free = i + 1;
240
- }
241
-
242
- break;
243
- }
244
-
245
- mask >>= 1;
246
- bit++;
247
- }
248
-
249
- if (free == -1) {
250
- return NGX_BUSY;
251
- }
252
-
253
- #if 0
254
- if (bl->busy == bl->max_busy) {
255
- return NGX_BUSY;
256
- }
257
- #endif
258
-
259
- ngx_memcpy(&bl->md5[free * 16], ctx->md5, 16);
260
- bl->md5_mask[free / 8] |= 1 << (free & 7);
261
- ctx->slot = free;
262
-
263
- bl->cacheable++;
264
- bl->busy++;
265
-
266
- return NGX_OK;
267
- }
268
-
269
-
270
- static void
271
- ngx_event_busy_lock_handler(ngx_event_t *ev)
272
- {
273
- ev->handler = ngx_event_busy_lock_posted_handler;
274
-
275
- ngx_post_event(ev, &ngx_posted_events);
276
- }
277
-
278
-
279
- static void
280
- ngx_event_busy_lock_posted_handler(ngx_event_t *ev)
281
- {
282
- ngx_event_busy_lock_ctx_t *ctx;
283
-
284
- ctx = ev->data;
285
- ctx->handler(ev);
286
- }
@@ -1,65 +0,0 @@
1
-
2
- /*
3
- * Copyright (C) Igor Sysoev
4
- * Copyright (C) Nginx, Inc.
5
- */
6
-
7
-
8
- #ifndef _NGX_EVENT_BUSY_LOCK_H_INCLUDED_
9
- #define _NGX_EVENT_BUSY_LOCK_H_INCLUDED_
10
-
11
-
12
- #include <ngx_config.h>
13
- #include <ngx_core.h>
14
- #include <ngx_event.h>
15
-
16
- typedef struct ngx_event_busy_lock_ctx_s ngx_event_busy_lock_ctx_t;
17
-
18
- struct ngx_event_busy_lock_ctx_s {
19
- ngx_event_t *event;
20
- ngx_event_handler_pt handler;
21
- void *data;
22
- ngx_msec_t timer;
23
-
24
- unsigned locked:1;
25
- unsigned waiting:1;
26
- unsigned cache_updated:1;
27
-
28
- char *md5;
29
- ngx_int_t slot;
30
-
31
- ngx_event_busy_lock_ctx_t *next;
32
- };
33
-
34
-
35
- typedef struct {
36
- u_char *md5_mask;
37
- char *md5;
38
- ngx_uint_t cacheable;
39
-
40
- ngx_uint_t busy;
41
- ngx_uint_t max_busy;
42
-
43
- ngx_uint_t waiting;
44
- ngx_uint_t max_waiting;
45
-
46
- ngx_event_busy_lock_ctx_t *events;
47
- ngx_event_busy_lock_ctx_t *last;
48
-
49
- #if (NGX_THREADS)
50
- ngx_mutex_t *mutex;
51
- #endif
52
- } ngx_event_busy_lock_t;
53
-
54
-
55
- ngx_int_t ngx_event_busy_lock(ngx_event_busy_lock_t *bl,
56
- ngx_event_busy_lock_ctx_t *ctx);
57
- ngx_int_t ngx_event_busy_lock_cacheable(ngx_event_busy_lock_t *bl,
58
- ngx_event_busy_lock_ctx_t *ctx);
59
- void ngx_event_busy_unlock(ngx_event_busy_lock_t *bl,
60
- ngx_event_busy_lock_ctx_t *ctx);
61
- void ngx_event_busy_lock_cancel(ngx_event_busy_lock_t *bl,
62
- ngx_event_busy_lock_ctx_t *ctx);
63
-
64
-
65
- #endif /* _NGX_EVENT_BUSY_LOCK_H_INCLUDED_ */