MINOR: lua: Add server name & puid to LUA Server class.
This commit is contained in:
parent
c6a1d711a4
commit
a62ae7ed9a
@ -922,6 +922,14 @@ Server class
|
|||||||
|
|
||||||
This class provides a way for manipulating servers and retrieving information.
|
This class provides a way for manipulating servers and retrieving information.
|
||||||
|
|
||||||
|
.. js:attribute:: Server.name
|
||||||
|
|
||||||
|
Contain the name of the server.
|
||||||
|
|
||||||
|
.. js:attribute:: Server.puid
|
||||||
|
|
||||||
|
Contain the proxy unique identifier of the server.
|
||||||
|
|
||||||
.. js:function:: Server.is_draining(sv)
|
.. js:function:: Server.is_draining(sv)
|
||||||
|
|
||||||
Return true if the server is currently draining sticky connections.
|
Return true if the server is currently draining sticky connections.
|
||||||
|
@ -490,6 +490,8 @@ int hlua_listener_get_stats(lua_State *L)
|
|||||||
|
|
||||||
int hlua_fcn_new_server(lua_State *L, struct server *srv)
|
int hlua_fcn_new_server(lua_State *L, struct server *srv)
|
||||||
{
|
{
|
||||||
|
char buffer[12];
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
|
||||||
/* Pop a class sesison metatable and affect it to the userdata. */
|
/* Pop a class sesison metatable and affect it to the userdata. */
|
||||||
@ -498,6 +500,18 @@ int hlua_fcn_new_server(lua_State *L, struct server *srv)
|
|||||||
|
|
||||||
lua_pushlightuserdata(L, srv);
|
lua_pushlightuserdata(L, srv);
|
||||||
lua_rawseti(L, -2, 0);
|
lua_rawseti(L, -2, 0);
|
||||||
|
|
||||||
|
/* Add server name. */
|
||||||
|
lua_pushstring(L, "name");
|
||||||
|
lua_pushstring(L, srv->id);
|
||||||
|
lua_settable(L, -3);
|
||||||
|
|
||||||
|
/* Add server puid. */
|
||||||
|
lua_pushstring(L, "puid");
|
||||||
|
snprintf(buffer, sizeof(buffer), "%d", srv->puid);
|
||||||
|
lua_pushstring(L, buffer);
|
||||||
|
lua_settable(L, -3);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user