mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
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:
@@ -481,6 +481,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();
|
||||||
|
|
||||||
@@ -531,7 +532,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++);
|
||||||
}
|
}
|
||||||
@@ -600,7 +606,11 @@ static void abortHook(lua_State *lua, lua_Debug *)
|
|||||||
|
|
||||||
void CLuaInstance::abortScript()
|
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
|
#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