Mercurial > hg > nginx-quic
annotate src/stream/ngx_stream_upstream_round_robin.h @ 6205:dcae651b2a0c
OCSP stapling: fixed ssl_stapling_file (ticket #769).
Broken by 6893a1007a7c (1.9.2) during introduction of strict OCSP response
validity checks. As stapling file is expected to be returned unconditionally,
fix is to set its validity to the maximum supported time.
Reported by Faidon Liambotis.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 07 Jul 2015 16:38:49 +0300 |
parents | 311d232ad803 |
children | 9757cffc1e2f |
rev | line source |
---|---|
6115 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #ifndef _NGX_STREAM_UPSTREAM_ROUND_ROBIN_H_INCLUDED_ | |
9 #define _NGX_STREAM_UPSTREAM_ROUND_ROBIN_H_INCLUDED_ | |
10 | |
11 | |
12 #include <ngx_config.h> | |
13 #include <ngx_core.h> | |
14 #include <ngx_stream.h> | |
15 | |
16 | |
17 typedef struct ngx_stream_upstream_rr_peer_s ngx_stream_upstream_rr_peer_t; | |
18 | |
19 struct ngx_stream_upstream_rr_peer_s { | |
20 struct sockaddr *sockaddr; | |
21 socklen_t socklen; | |
22 ngx_str_t name; | |
23 ngx_str_t server; | |
24 | |
25 ngx_int_t current_weight; | |
26 ngx_int_t effective_weight; | |
27 ngx_int_t weight; | |
28 | |
29 ngx_uint_t conns; | |
30 | |
31 ngx_uint_t fails; | |
32 time_t accessed; | |
33 time_t checked; | |
34 | |
35 ngx_uint_t max_fails; | |
36 time_t fail_timeout; | |
37 | |
38 ngx_uint_t down; /* unsigned down:1; */ | |
39 | |
40 #if (NGX_STREAM_SSL) | |
41 void *ssl_session; | |
42 int ssl_session_len; | |
43 #endif | |
44 | |
45 ngx_stream_upstream_rr_peer_t *next; | |
46 | |
47 #if (NGX_STREAM_UPSTREAM_ZONE) | |
48 ngx_atomic_t lock; | |
49 #endif | |
50 }; | |
51 | |
52 | |
53 typedef struct ngx_stream_upstream_rr_peers_s ngx_stream_upstream_rr_peers_t; | |
54 | |
55 struct ngx_stream_upstream_rr_peers_s { | |
56 ngx_uint_t number; | |
57 | |
58 #if (NGX_STREAM_UPSTREAM_ZONE) | |
59 ngx_slab_pool_t *shpool; | |
60 ngx_atomic_t rwlock; | |
6198
311d232ad803
Upstream: fixed shared upstreams on win32.
Ruslan Ermilov <ru@nginx.com>
parents:
6115
diff
changeset
|
61 ngx_stream_upstream_rr_peers_t *zone_next; |
6115 | 62 #endif |
63 | |
64 ngx_uint_t total_weight; | |
65 | |
66 unsigned single:1; | |
67 unsigned weighted:1; | |
68 | |
69 ngx_str_t *name; | |
70 | |
71 ngx_stream_upstream_rr_peers_t *next; | |
72 | |
73 ngx_stream_upstream_rr_peer_t *peer; | |
74 }; | |
75 | |
76 | |
77 #if (NGX_STREAM_UPSTREAM_ZONE) | |
78 | |
79 #define ngx_stream_upstream_rr_peers_rlock(peers) \ | |
80 \ | |
81 if (peers->shpool) { \ | |
82 ngx_rwlock_rlock(&peers->rwlock); \ | |
83 } | |
84 | |
85 #define ngx_stream_upstream_rr_peers_wlock(peers) \ | |
86 \ | |
87 if (peers->shpool) { \ | |
88 ngx_rwlock_wlock(&peers->rwlock); \ | |
89 } | |
90 | |
91 #define ngx_stream_upstream_rr_peers_unlock(peers) \ | |
92 \ | |
93 if (peers->shpool) { \ | |
94 ngx_rwlock_unlock(&peers->rwlock); \ | |
95 } | |
96 | |
97 | |
98 #define ngx_stream_upstream_rr_peer_lock(peers, peer) \ | |
99 \ | |
100 if (peers->shpool) { \ | |
101 ngx_rwlock_wlock(&peer->lock); \ | |
102 } | |
103 | |
104 #define ngx_stream_upstream_rr_peer_unlock(peers, peer) \ | |
105 \ | |
106 if (peers->shpool) { \ | |
107 ngx_rwlock_unlock(&peer->lock); \ | |
108 } | |
109 | |
110 #else | |
111 | |
112 #define ngx_stream_upstream_rr_peers_rlock(peers) | |
113 #define ngx_stream_upstream_rr_peers_wlock(peers) | |
114 #define ngx_stream_upstream_rr_peers_unlock(peers) | |
115 #define ngx_stream_upstream_rr_peer_lock(peers, peer) | |
116 #define ngx_stream_upstream_rr_peer_unlock(peers, peer) | |
117 | |
118 #endif | |
119 | |
120 | |
121 typedef struct { | |
122 ngx_stream_upstream_rr_peers_t *peers; | |
123 ngx_stream_upstream_rr_peer_t *current; | |
124 uintptr_t *tried; | |
125 uintptr_t data; | |
126 } ngx_stream_upstream_rr_peer_data_t; | |
127 | |
128 | |
129 ngx_int_t ngx_stream_upstream_init_round_robin(ngx_conf_t *cf, | |
130 ngx_stream_upstream_srv_conf_t *us); | |
131 ngx_int_t ngx_stream_upstream_init_round_robin_peer(ngx_stream_session_t *s, | |
132 ngx_stream_upstream_srv_conf_t *us); | |
133 ngx_int_t ngx_stream_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, | |
134 void *data); | |
135 void ngx_stream_upstream_free_round_robin_peer(ngx_peer_connection_t *pc, | |
136 void *data, ngx_uint_t state); | |
137 | |
138 | |
139 #endif /* _NGX_STREAM_UPSTREAM_ROUND_ROBIN_H_INCLUDED_ */ |