From 511cae77f16e3efe149b753c575c66ce0be358ab Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 27 Apr 2018 16:46:38 +0200 Subject: [PATCH] chg: 'lua scripting' - getfrombigbuf has now timeout --- client/scripting.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/scripting.c b/client/scripting.c index 1ad6a7cc4..5c5749284 100644 --- a/client/scripting.c +++ b/client/scripting.c @@ -79,8 +79,15 @@ static int l_GetFromBigBuf(lua_State *L){ return 2; // two return values } - GetFromBigBuf(data, len, startindex); - WaitForResponse(CMD_ACK, NULL); + GetFromBigBuf(data, len, startindex); + + if ( !WaitForResponseTimeout(CMD_ACK, NULL, 2500) ) { + free(data); + lua_pushnil(L); + lua_pushstring(L,"command execution time out"); + return 2; + } + //Push it as a string lua_pushlstring(L,(const char *)data, len); if (data)