MINOR: lua: add get_maxconn and set_maxconn to LUA Server class.
This commit is contained in:
parent
a62ae7ed9a
commit
32d539fa88
@ -938,6 +938,23 @@ Server class
|
|||||||
server.
|
server.
|
||||||
:returns: a boolean
|
:returns: a boolean
|
||||||
|
|
||||||
|
.. js:function:: Server.set_maxconn(sv, weight)
|
||||||
|
|
||||||
|
Dynamically change the maximum connections of the server. See the management
|
||||||
|
socket documentation for more information about the format of the string.
|
||||||
|
|
||||||
|
:param class_server sv: A :ref:`server_class` which indicates the manipulated
|
||||||
|
server.
|
||||||
|
:param string maxconn: A string describing the server maximum connections.
|
||||||
|
|
||||||
|
.. js:function:: Server.get_maxconn(sv, weight)
|
||||||
|
|
||||||
|
This function returns an integer representing the server maximum connections.
|
||||||
|
|
||||||
|
:param class_server sv: A :ref:`server_class` which indicates the manipulated
|
||||||
|
server.
|
||||||
|
:returns: an integer.
|
||||||
|
|
||||||
.. js:function:: Server.set_weight(sv, weight)
|
.. js:function:: Server.set_weight(sv, weight)
|
||||||
|
|
||||||
Dynamically change the weight of the server. See the management socket
|
Dynamically change the weight of the server. See the management socket
|
||||||
|
@ -592,6 +592,34 @@ int hlua_server_is_draining(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int hlua_server_set_maxconn(lua_State *L)
|
||||||
|
{
|
||||||
|
struct server *srv;
|
||||||
|
const char *maxconn;
|
||||||
|
const char *err;
|
||||||
|
|
||||||
|
srv = hlua_check_server(L, 1);
|
||||||
|
maxconn = luaL_checkstring(L, 2);
|
||||||
|
|
||||||
|
HA_SPIN_LOCK(SERVER_LOCK, &srv->lock);
|
||||||
|
err = server_parse_maxconn_change_request(srv, maxconn);
|
||||||
|
HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
|
||||||
|
if (!err)
|
||||||
|
lua_pushnil(L);
|
||||||
|
else
|
||||||
|
hlua_pushstrippedstring(L, err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int hlua_server_get_maxconn(lua_State *L)
|
||||||
|
{
|
||||||
|
struct server *srv;
|
||||||
|
|
||||||
|
srv = hlua_check_server(L, 1);
|
||||||
|
lua_pushinteger(L, srv->maxconn);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int hlua_server_set_weight(lua_State *L)
|
int hlua_server_set_weight(lua_State *L)
|
||||||
{
|
{
|
||||||
struct server *srv;
|
struct server *srv;
|
||||||
@ -1274,6 +1302,8 @@ int hlua_fcn_reg_core_fcn(lua_State *L)
|
|||||||
lua_pushstring(L, "__index");
|
lua_pushstring(L, "__index");
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
hlua_class_function(L, "is_draining", hlua_server_is_draining);
|
hlua_class_function(L, "is_draining", hlua_server_is_draining);
|
||||||
|
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);
|
hlua_class_function(L, "set_weight", hlua_server_set_weight);
|
||||||
hlua_class_function(L, "get_weight", hlua_server_get_weight);
|
hlua_class_function(L, "get_weight", hlua_server_get_weight);
|
||||||
hlua_class_function(L, "set_addr", hlua_server_set_addr);
|
hlua_class_function(L, "set_addr", hlua_server_set_addr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user