mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-17 02:56:51 +00:00
MINOR: hlua_fcn: add Server.is_backup()
This function returns true if the current server is a backup server.
This commit is contained in:
parent
862a0fe75a
commit
c72051d53a
@ -1158,6 +1158,14 @@ Server class
|
||||
server.
|
||||
:returns: a boolean
|
||||
|
||||
.. js:function:: Server.is_backup(sv)
|
||||
|
||||
Return true if the server is a backup server
|
||||
|
||||
:param class_server sv: A :ref:`server_class` which indicates the manipulated
|
||||
server.
|
||||
:returns: a boolean
|
||||
|
||||
.. js:function:: Server.set_maxconn(sv, weight)
|
||||
|
||||
Dynamically change the maximum connections of the server. See the management
|
||||
|
@ -1072,6 +1072,20 @@ int hlua_server_is_draining(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int hlua_server_is_backup(lua_State *L)
|
||||
{
|
||||
struct server *srv;
|
||||
|
||||
srv = hlua_check_server(L, 1);
|
||||
if (srv == NULL) {
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
lua_pushboolean(L, (srv->flags & SRV_F_BACKUP));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int hlua_server_set_maxconn(lua_State *L)
|
||||
{
|
||||
struct server *srv;
|
||||
@ -1422,6 +1436,7 @@ int hlua_fcn_new_server(lua_State *L, struct server *srv)
|
||||
hlua_class_function(L, "get_puid", hlua_server_get_puid);
|
||||
hlua_class_function(L, "get_rid", hlua_server_get_rid);
|
||||
hlua_class_function(L, "is_draining", hlua_server_is_draining);
|
||||
hlua_class_function(L, "is_backup", hlua_server_is_backup);
|
||||
hlua_class_function(L, "set_maxconn", hlua_server_set_maxconn);
|
||||
hlua_class_function(L, "get_maxconn", hlua_server_get_maxconn);
|
||||
hlua_class_function(L, "set_weight", hlua_server_set_weight);
|
||||
|
Loading…
Reference in New Issue
Block a user