15.07.2018, 19:56
Take a real example:
• Player_1 connects to the server.
• We increase mysql_race and it becomes 1.
• Query takes too long and Player_1 disconnects.
• We increase once again mysql_race and it becomes 2.
• Player_2 connects to the server.
• We increase mysql_race and it becomes 3.
• Finally the query is finished and it's the moment of truth.
• mysql_race that was passed in mysql callback is 1 != mysql_race of current player which is 3 so the query was for Player_1 but disconnected and Player_2 connected but it is the wrong person.
• Player_1 connects to the server.
• We increase mysql_race and it becomes 1.
• Query takes too long and Player_1 disconnects.
• We increase once again mysql_race and it becomes 2.
• Player_2 connects to the server.
• We increase mysql_race and it becomes 3.
• Finally the query is finished and it's the moment of truth.
• mysql_race that was passed in mysql callback is 1 != mysql_race of current player which is 3 so the query was for Player_1 but disconnected and Player_2 connected but it is the wrong person.