Skip to content

Commit

Permalink
fix #5335: desync in Spring.GetUnitCommands() with bogous lua code
Browse files Browse the repository at this point in the history
  • Loading branch information
abma committed Aug 25, 2016
1 parent 834d0c6 commit a15a6ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rts/Lua/LuaSyncedRead.cpp
Expand Up @@ -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__);
}
Expand Down

0 comments on commit a15a6ac

Please sign in to comment.