mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
luainstance: add possibility to skip timeout ([basicsocket] receive timed out.) with luaclient <plugin> <...> DisableAbort
This commit is contained in:
@@ -473,6 +473,7 @@ const char CLuaInstance::className[] = LUA_CLASSNAME;
|
|||||||
|
|
||||||
CLuaInstance::CLuaInstance()
|
CLuaInstance::CLuaInstance()
|
||||||
{
|
{
|
||||||
|
DisableAbort = true;
|
||||||
/* Create the intepreter object. */
|
/* Create the intepreter object. */
|
||||||
lua = luaL_newstate();
|
lua = luaL_newstate();
|
||||||
|
|
||||||
@@ -523,7 +524,12 @@ void CLuaInstance::runScript(const char *fileName, std::vector<std::string> *arg
|
|||||||
lua_rawseti(lua, -2, n++);
|
lua_rawseti(lua, -2, n++);
|
||||||
|
|
||||||
if (argv && (!argv->empty())) {
|
if (argv && (!argv->empty())) {
|
||||||
|
std::string abort = "DisableAbort";
|
||||||
for(std::vector<std::string>::iterator it = argv->begin(); it != argv->end(); ++it) {
|
for(std::vector<std::string>::iterator it = argv->begin(); it != argv->end(); ++it) {
|
||||||
|
if (!it->compare(abort)) {
|
||||||
|
DisableAbort = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
lua_pushstring(lua, it->c_str());
|
lua_pushstring(lua, it->c_str());
|
||||||
lua_rawseti(lua, -2, n++);
|
lua_rawseti(lua, -2, n++);
|
||||||
}
|
}
|
||||||
@@ -592,7 +598,11 @@ static void abortHook(lua_State *lua, lua_Debug *)
|
|||||||
|
|
||||||
void CLuaInstance::abortScript()
|
void CLuaInstance::abortScript()
|
||||||
{
|
{
|
||||||
|
if(DisableAbort)
|
||||||
lua_sethook(lua, &abortHook, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
|
lua_sethook(lua, &abortHook, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
|
||||||
|
else
|
||||||
|
fprintf(stderr, "DisableAbort Script is aktiv\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef STATIC_LUAPOSIX
|
#ifdef STATIC_LUAPOSIX
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
~CLuaInstance();
|
~CLuaInstance();
|
||||||
void runScript(const char *fileName, std::vector<std::string> *argv = NULL, std::string *result_code = NULL, std::string *result_string = NULL, std::string *error_string = NULL);
|
void runScript(const char *fileName, std::vector<std::string> *argv = NULL, std::string *result_code = NULL, std::string *result_string = NULL, std::string *error_string = NULL);
|
||||||
void abortScript();
|
void abortScript();
|
||||||
|
bool DisableAbort;
|
||||||
enum {
|
enum {
|
||||||
DYNFONT_NO_ERROR = 0,
|
DYNFONT_NO_ERROR = 0,
|
||||||
DYNFONT_MAXIMUM_FONTS = 1,
|
DYNFONT_MAXIMUM_FONTS = 1,
|
||||||
|
Reference in New Issue
Block a user