mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-01 11:01:46 +00:00
MINOR: hlua_fcn: add Server.get_proxy()
Server.get_proxy(): get the proxy to which the server belongs (or nil if not available)
This commit is contained in:
parent
4be36a1337
commit
3889efa8e4
@ -1233,6 +1233,14 @@ Server class
|
||||
server.
|
||||
:returns: a key/value table containing stats
|
||||
|
||||
.. js:function:: Server.get_proxy(sv)
|
||||
|
||||
Returns the parent proxy to which the server belongs.
|
||||
|
||||
:param class_server sv: A :ref:`server_class` which indicates the manipulated
|
||||
server.
|
||||
:returns: a :ref:`proxy_class` or nil if not available
|
||||
|
||||
.. js:function:: Server.shut_sess(sv)
|
||||
|
||||
Shutdown all the sessions attached to the server. See the management socket
|
||||
|
@ -34,6 +34,7 @@ void *hlua_checkudata(lua_State *L, int ud, int class_ref);
|
||||
int hlua_register_metatable(struct lua_State *L, char *name);
|
||||
void hlua_fcn_reg_core_fcn(lua_State *L);
|
||||
int hlua_dump_object(lua_State *L);
|
||||
int hlua_fcn_new_proxy(lua_State *L, struct proxy *px);
|
||||
int hlua_fcn_new_server(lua_State *L, struct server *srv);
|
||||
int hlua_fcn_new_event_sub(lua_State *L, struct event_hdl_sub *sub);
|
||||
|
||||
|
@ -941,6 +941,25 @@ int hlua_server_get_stats(lua_State *L)
|
||||
|
||||
}
|
||||
|
||||
int hlua_server_get_proxy(lua_State *L)
|
||||
{
|
||||
struct server *srv;
|
||||
|
||||
srv = hlua_check_server(L, 1);
|
||||
if (srv == NULL) {
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!srv->proxy) {
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
hlua_fcn_new_proxy(L, srv->proxy);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int hlua_server_get_addr(lua_State *L)
|
||||
{
|
||||
struct server *srv;
|
||||
@ -1503,6 +1522,7 @@ int hlua_fcn_new_server(lua_State *L, struct server *srv)
|
||||
hlua_class_function(L, "set_addr", hlua_server_set_addr);
|
||||
hlua_class_function(L, "get_addr", hlua_server_get_addr);
|
||||
hlua_class_function(L, "get_stats", hlua_server_get_stats);
|
||||
hlua_class_function(L, "get_proxy", hlua_server_get_proxy);
|
||||
hlua_class_function(L, "shut_sess", hlua_server_shut_sess);
|
||||
hlua_class_function(L, "set_drain", hlua_server_set_drain);
|
||||
hlua_class_function(L, "set_maint", hlua_server_set_maint);
|
||||
|
Loading…
Reference in New Issue
Block a user