Closed chronolaw closed 1 year ago
See https://github.com/Kong/kong/issues/9582, test cases: https://github.com/Kong/kong/pull/9856.
The point is cpool_crc32 in C land.
cpool_crc32
balancer.lua
cpool_name
cpool_name_len
ngx_http_lua_balancer.c
crc32
ngx_http_lua_ffi_balancer_set_current_peer
ngx_http_lua_ffi_balancer_enable_keepalive
bp->host
ngx_http_lua_balancer_create_keepalive_pool
lua_newuserdata
ngx_http_lua_balancer_get_keepalive_pool
ngx_http_lua_balancer_free_keepalive_pool
We have turned to the new bazel build system, so patches should be there.
See https://github.com/Kong/kong/issues/9582, test cases: https://github.com/Kong/kong/pull/9856.
The point is
cpool_crc32
in C land.balancer.lua
cpool_name
cpool_name_len
to C landngx_http_lua_balancer.c
crc32
andcpool_crc32
cpool_name
to store pool name stringngx_http_lua_ffi_balancer_set_current_peer
: allocate memory and copy pool namengx_http_lua_ffi_balancer_enable_keepalive
: set default pool name tobp->host
ngx_http_lua_balancer_create_keepalive_pool
:lua_newuserdata
, copy pool name, then set to upoolngx_http_lua_balancer_get_keepalive_pool
: use pool name to index upoolngx_http_lua_balancer_free_keepalive_pool
: get pool name and set to nil