我用scan-build检测了下lua模块,发现了一个问题,是在ngx_http_lua_get_keepalive_peer中:
ngx_http_lua_get_keepalive_peer(ngx_http_request_t *r, lua_State *L,
int obj_index, int key_index, ngx_http_lua_socket_upstream_t *u)
{
ngx_http_lua_socket_pool_item_t *item;
ngx_http_lua_socket_pool_t *spool;
ngx_http_cleanup_t *cln;
ngx_queue_t *q;
int top;
ngx_peer_connection_t *pc;
ngx_connection_t *c;
top = lua_gettop(L);
if (key_index < 0) {
key_index = top + key_index + 1;
}
if (obj_index < 0) {
obj_index = top + obj_index + 1;
}
..........................................
}
就上面这段代码,其中obj_index后续完全没有使用,那么这个是遗留代码,还是说为了以后的扩展?
谢谢!