luainstance: add possibility to skip timeout ([basicsocket] receive timed out.) with luaclient <plugin> <...> DisableAbort

Origin commit data
------------------
Branch: ni/coolstream
Commit: 5213b87e92
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2021-09-03 (Fri, 03 Sep 2021)

Origin message was:
------------------
luainstance: add possibility to skip timeout ([basicsocket] receive timed out.) with luaclient <plugin> <...> DisableAbort

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2021-09-03 09:19:22 +02:00
committed by vanhofen
parent 7ad1ccea6c
commit 509dfa4982
2 changed files with 12 additions and 2 deletions

View File

@@ -481,6 +481,7 @@ const char CLuaInstance::className[] = LUA_CLASSNAME;
CLuaInstance::CLuaInstance()
{
DisableAbort = true;
/* Create the intepreter object. */
lua = luaL_newstate();
@@ -531,7 +532,12 @@ void CLuaInstance::runScript(const char *fileName, std::vector<std::string> *arg
lua_rawseti(lua, -2, n++);
if (argv && (!argv->empty())) {
std::string abort = "DisableAbort";
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_rawseti(lua, -2, n++);
}
@@ -600,7 +606,11 @@ static void abortHook(lua_State *lua, lua_Debug *)
void CLuaInstance::abortScript()
{
lua_sethook(lua, &abortHook, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
if(DisableAbort)
lua_sethook(lua, &abortHook, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
else
fprintf(stderr, "DisableAbort Script is aktiv\n");
}
#ifdef STATIC_LUAPOSIX

View File

@@ -42,7 +42,7 @@ public:
~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 abortScript();
bool DisableAbort;
enum {
DYNFONT_NO_ERROR = 0,
DYNFONT_MAXIMUM_FONTS = 1,