Skip to content

Commit fc5aced

Browse files
unused vars
1 parent ddc66f3 commit fc5aced

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

patch/1.27.1.1/ngx_lua-enable_keepalive.patch

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git src/ngx_http_lua_balancer.c src/ngx_http_lua_balancer.c
2-
index ae0f1380..1d3fcb74 100644
2+
index ae0f1380..a51532da 100644
33
--- src/ngx_http_lua_balancer.c
44
+++ src/ngx_http_lua_balancer.c
55
@@ -31,10 +31,39 @@ typedef struct {
@@ -143,9 +143,13 @@ index ae0f1380..1d3fcb74 100644
143143

144144
lscf->balancer.original_init_upstream = uscf->peer.init_upstream;
145145

146-
@@ -290,12 +328,9 @@ ngx_http_lua_balancer_init(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
147-
ngx_uint_t bucket_cnt;
148-
ngx_queue_t *buckets;
146+
@@ -286,16 +324,10 @@ ngx_http_lua_balancer_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,
147+
static ngx_int_t
148+
ngx_http_lua_balancer_init(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
149+
{
150+
- ngx_uint_t i;
151+
- ngx_uint_t bucket_cnt;
152+
- ngx_queue_t *buckets;
149153
ngx_http_lua_srv_conf_t *lscf;
150154
- ngx_http_lua_balancer_ka_item_t *cached;
151155

@@ -156,7 +160,7 @@ index ae0f1380..1d3fcb74 100644
156160
if (lscf->balancer.original_init_upstream(cf, us) != NGX_OK) {
157161
return NGX_ERROR;
158162
}
159-
@@ -304,38 +339,6 @@ ngx_http_lua_balancer_init(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
163+
@@ -304,38 +336,6 @@ ngx_http_lua_balancer_init(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
160164

161165
us->peer.init = ngx_http_lua_balancer_init_peer;
162166

@@ -195,23 +199,23 @@ index ae0f1380..1d3fcb74 100644
195199
return NGX_OK;
196200
}
197201

198-
@@ -387,6 +390,7 @@ ngx_http_lua_balancer_get_peer(ngx_peer_connection_t *pc, void *data)
202+
@@ -387,6 +387,7 @@ ngx_http_lua_balancer_get_peer(ngx_peer_connection_t *pc, void *data)
199203
void *pdata;
200204
lua_State *L;
201205
ngx_int_t rc;
202206
+ ngx_queue_t *q;
203207
ngx_connection_t *c;
204208
ngx_http_request_t *r;
205209
#if (NGX_HTTP_SSL)
206-
@@ -394,6 +398,7 @@ ngx_http_lua_balancer_get_peer(ngx_peer_connection_t *pc, void *data)
210+
@@ -394,6 +395,7 @@ ngx_http_lua_balancer_get_peer(ngx_peer_connection_t *pc, void *data)
207211
#endif
208212
ngx_http_lua_ctx_t *ctx;
209213
ngx_http_lua_srv_conf_t *lscf;
210214
+ ngx_http_lua_balancer_keepalive_item_t *item;
211215
ngx_http_lua_balancer_peer_data_t *bp = data;
212216

213217
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
214-
@@ -425,9 +430,12 @@ ngx_http_lua_balancer_get_peer(ngx_peer_connection_t *pc, void *data)
218+
@@ -425,9 +427,12 @@ ngx_http_lua_balancer_get_peer(ngx_peer_connection_t *pc, void *data)
215219

216220
ctx->context = NGX_HTTP_LUA_CONTEXT_BALANCER;
217221

@@ -224,7 +228,7 @@ index ae0f1380..1d3fcb74 100644
224228
bp->keepalive_requests = 0;
225229
bp->keepalive_timeout = 0;
226230
bp->keepalive = 0;
227-
@@ -465,10 +473,10 @@ ngx_http_lua_balancer_get_peer(ngx_peer_connection_t *pc, void *data)
231+
@@ -465,10 +470,10 @@ ngx_http_lua_balancer_get_peer(ngx_peer_connection_t *pc, void *data)
228232
pc->local = bp->local;
229233
}
230234

@@ -237,7 +241,7 @@ index ae0f1380..1d3fcb74 100644
237241
pc->cached = 0;
238242
pc->connection = NULL;
239243

240-
@@ -476,27 +484,59 @@ ngx_http_lua_balancer_get_peer(ngx_peer_connection_t *pc, void *data)
244+
@@ -476,27 +481,59 @@ ngx_http_lua_balancer_get_peer(ngx_peer_connection_t *pc, void *data)
241245
r->upstream->peer.tries += bp->more_tries;
242246
}
243247

@@ -310,7 +314,7 @@ index ae0f1380..1d3fcb74 100644
310314
}
311315

312316
return NGX_OK;
313-
@@ -577,14 +617,12 @@ static void
317+
@@ -577,14 +614,12 @@ static void
314318
ngx_http_lua_balancer_free_peer(ngx_peer_connection_t *pc, void *data,
315319
ngx_uint_t state)
316320
{
@@ -327,7 +331,7 @@ index ae0f1380..1d3fcb74 100644
327331

328332
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
329333
"lua balancer: free peer, tries: %ui", pc->tries);
330-
@@ -592,14 +630,16 @@ ngx_http_lua_balancer_free_peer(ngx_peer_connection_t *pc, void *data,
334+
@@ -592,14 +627,16 @@ ngx_http_lua_balancer_free_peer(ngx_peer_connection_t *pc, void *data,
331335
u = bp->request->upstream;
332336
c = pc->connection;
333337

@@ -346,7 +350,7 @@ index ae0f1380..1d3fcb74 100644
346350
if (state & NGX_PEER_FAILED
347351
|| c == NULL
348352
|| c->read->eof
349-
@@ -633,42 +673,41 @@ ngx_http_lua_balancer_free_peer(ngx_peer_connection_t *pc, void *data,
353+
@@ -633,42 +670,41 @@ ngx_http_lua_balancer_free_peer(ngx_peer_connection_t *pc, void *data,
350354
goto invalid;
351355
}
352356

@@ -408,7 +412,7 @@ index ae0f1380..1d3fcb74 100644
408412

409413
if (c->write->timer_set) {
410414
ngx_del_timer(c->write);
411-
@@ -684,42 +723,6 @@ ngx_http_lua_balancer_free_peer(ngx_peer_connection_t *pc, void *data,
415+
@@ -684,42 +720,6 @@ ngx_http_lua_balancer_free_peer(ngx_peer_connection_t *pc, void *data,
412416
c->write->log = ngx_cycle->log;
413417
c->pool->log = ngx_cycle->log;
414418

@@ -451,7 +455,7 @@ index ae0f1380..1d3fcb74 100644
451455
if (c->read->ready) {
452456
ngx_http_lua_balancer_close_handler(c->read);
453457
}
454-
@@ -728,9 +731,16 @@ ngx_http_lua_balancer_free_peer(ngx_peer_connection_t *pc, void *data,
458+
@@ -728,9 +728,16 @@ ngx_http_lua_balancer_free_peer(ngx_peer_connection_t *pc, void *data,
455459

456460
invalid:
457461

@@ -471,7 +475,7 @@ index ae0f1380..1d3fcb74 100644
471475
}
472476

473477
return;
474-
@@ -740,6 +750,123 @@ invalid:
478+
@@ -740,6 +747,123 @@ invalid:
475479
}
476480

477481

@@ -595,7 +599,7 @@ index ae0f1380..1d3fcb74 100644
595599
static void
596600
ngx_http_lua_balancer_notify_peer(ngx_peer_connection_t *pc, void *data,
597601
ngx_uint_t type)
598-
@@ -755,6 +882,10 @@ ngx_http_lua_balancer_notify_peer(ngx_peer_connection_t *pc, void *data,
602+
@@ -755,6 +879,10 @@ ngx_http_lua_balancer_notify_peer(ngx_peer_connection_t *pc, void *data,
599603
static void
600604
ngx_http_lua_balancer_close(ngx_connection_t *c)
601605
{
@@ -606,7 +610,7 @@ index ae0f1380..1d3fcb74 100644
606610
#if (NGX_HTTP_SSL)
607611
if (c->ssl) {
608612
c->ssl->no_wait_shutdown = 1;
609-
@@ -762,9 +893,6 @@ ngx_http_lua_balancer_close(ngx_connection_t *c)
613+
@@ -762,9 +890,6 @@ ngx_http_lua_balancer_close(ngx_connection_t *c)
610614

611615
if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
612616
c->ssl->handler = ngx_http_lua_balancer_close;
@@ -616,7 +620,7 @@ index ae0f1380..1d3fcb74 100644
616620
return;
617621
}
618622
}
619-
@@ -773,8 +901,12 @@ ngx_http_lua_balancer_close(ngx_connection_t *c)
623+
@@ -773,8 +898,12 @@ ngx_http_lua_balancer_close(ngx_connection_t *c)
620624
ngx_destroy_pool(c->pool);
621625
ngx_close_connection(c);
622626

@@ -631,7 +635,7 @@ index ae0f1380..1d3fcb74 100644
631635
}
632636

633637

634-
@@ -789,7 +921,7 @@ ngx_http_lua_balancer_dummy_handler(ngx_event_t *ev)
638+
@@ -789,7 +918,7 @@ ngx_http_lua_balancer_dummy_handler(ngx_event_t *ev)
635639
static void
636640
ngx_http_lua_balancer_close_handler(ngx_event_t *ev)
637641
{
@@ -640,7 +644,7 @@ index ae0f1380..1d3fcb74 100644
640644

641645
int n;
642646
char buf[1];
643-
@@ -820,8 +952,10 @@ close:
647+
@@ -820,8 +949,10 @@ close:
644648
ngx_http_lua_balancer_close(c);
645649

646650
ngx_queue_remove(&item->queue);
@@ -653,7 +657,7 @@ index ae0f1380..1d3fcb74 100644
653657
}
654658

655659

656-
@@ -832,7 +966,7 @@ ngx_http_lua_balancer_set_session(ngx_peer_connection_t *pc, void *data)
660+
@@ -832,7 +963,7 @@ ngx_http_lua_balancer_set_session(ngx_peer_connection_t *pc, void *data)
657661
{
658662
ngx_http_lua_balancer_peer_data_t *bp = data;
659663

@@ -662,7 +666,7 @@ index ae0f1380..1d3fcb74 100644
662666
/* TODO */
663667
return NGX_OK;
664668
}
665-
@@ -846,7 +980,7 @@ ngx_http_lua_balancer_save_session(ngx_peer_connection_t *pc, void *data)
669+
@@ -846,7 +977,7 @@ ngx_http_lua_balancer_save_session(ngx_peer_connection_t *pc, void *data)
666670
{
667671
ngx_http_lua_balancer_peer_data_t *bp = data;
668672

@@ -671,7 +675,7 @@ index ae0f1380..1d3fcb74 100644
671675
/* TODO */
672676
return;
673677
}
674-
@@ -859,9 +993,8 @@ ngx_http_lua_balancer_save_session(ngx_peer_connection_t *pc, void *data)
678+
@@ -859,9 +990,8 @@ ngx_http_lua_balancer_save_session(ngx_peer_connection_t *pc, void *data)
675679

676680
int
677681
ngx_http_lua_ffi_balancer_set_current_peer(ngx_http_request_t *r,
@@ -683,7 +687,7 @@ index ae0f1380..1d3fcb74 100644
683687
{
684688
ngx_url_t url;
685689
ngx_http_lua_ctx_t *ctx;
686-
@@ -920,32 +1053,15 @@ ngx_http_lua_ffi_balancer_set_current_peer(ngx_http_request_t *r,
690+
@@ -920,32 +1050,15 @@ ngx_http_lua_ffi_balancer_set_current_peer(ngx_http_request_t *r,
687691
if (url.addrs && url.addrs[0].sockaddr) {
688692
bp->sockaddr = url.addrs[0].sockaddr;
689693
bp->socklen = url.addrs[0].socklen;
@@ -719,7 +723,7 @@ index ae0f1380..1d3fcb74 100644
719723

720724
return NGX_OK;
721725
}
722-
@@ -1050,11 +1166,15 @@ ngx_http_lua_ffi_balancer_enable_keepalive(ngx_http_request_t *r,
726+
@@ -1050,11 +1163,15 @@ ngx_http_lua_ffi_balancer_enable_keepalive(ngx_http_request_t *r,
723727

724728
bp = (ngx_http_lua_balancer_peer_data_t *) u->peer.data;
725729

@@ -736,7 +740,7 @@ index ae0f1380..1d3fcb74 100644
736740
bp->keepalive_timeout = (ngx_msec_t) timeout;
737741
bp->keepalive_requests = (ngx_uint_t) max_requests;
738742
bp->keepalive = 1;
739-
@@ -1375,138 +1495,4 @@ ngx_http_lua_balancer_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
743+
@@ -1375,138 +1492,4 @@ ngx_http_lua_balancer_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
740744
return NGX_CONF_OK;
741745
}
742746

0 commit comments

Comments
 (0)