From a15a6acb4bfbfa4d2287afeec7946a257271bd2e Mon Sep 17 00:00:00 2001 From: abma Date: Thu, 25 Aug 2016 03:47:32 +0200 Subject: [PATCH] fix #5335: desync in Spring.GetUnitCommands() with bogous lua code --- rts/Lua/LuaSyncedRead.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rts/Lua/LuaSyncedRead.cpp b/rts/Lua/LuaSyncedRead.cpp index 256a33f06b6..73e9071e027 100644 --- a/rts/Lua/LuaSyncedRead.cpp +++ b/rts/Lua/LuaSyncedRead.cpp @@ -4012,10 +4012,10 @@ int LuaSyncedRead::GetUnitCommands(lua_State* L) static int calls = 0; static spring_time nextWarning = spring_gettime(); calls++; - if (spring_gettime() >= nextWarning) { + if (spring_gettime() >= nextWarning) { //spring_gettime() isn't sync-safe! nextWarning = spring_gettime() + spring_secs(5); if (calls > 1000) { - luaL_error(L, + LOG_L(L_ERROR, "[%s] called too often without a 2nd argument to define maxNumCmds returned in the table, please check your code!\n" "Especially when you only read the first cmd or want to check if the queue is non-empty, this can be a huge performance leak!\n", __FUNCTION__); }