openresty / lua-resty-balancer

A generic consistent hash implementation for OpenResty/Lua
322 stars 77 forks source link

pass ip:port as the addr and pass 0 as port to lua-resty-core/lib/ngx/balancer.lua #17

Open yfgu opened 7 years ago

yfgu commented 7 years ago

I integrated the level077/lua-resty-upstream-etcd into my project. The function b.set_current_peer(server) in the lua-resty-upstream-etcd/balancer.lua pass the 10.20.22.85:8010 and nil into the function of _M.set_current_peer(addr, port) in lua-resty-core/lib/ngx/balancer.lua. So the default port is 0 in lua-resty-core/lib/ngx/balancer.lua. I got no error after integration. Does the C.ngx_http_lua_ffi_balancer_set_current_peer deal with the addr as ip:port and port as 0 correctly? What's the usage of the port, it seems that it is Unnecessary.

Write