mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/LCE-Revelations.git
synced 2026-06-05 08:25:32 +00:00
fix: dedicated server thread safety, disconnect deadlock, and console freeze
- Protect PlayerList and ServerConnection players vectors with critical sections; all iterations use copy-on-read snapshots to prevent iterator invalidation during concurrent join/leave - Add null check on player bounding box in movement validation to prevent crash when player is removed mid-tick - Re-validate socket player pointer immediately before SendData to narrow the TOCTOU race window on disconnect - Replace inline disconnect cleanup with a queued system drained on the main tick thread, eliminating the done_cs -> m_playersCS lock inversion that caused deadlocks under load - Disable Windows QuickEdit mode at server startup to prevent console input selection from freezing the process - Move chunk priority sort behind ServerConnection::sortPlayersByChunkPriority() to keep the players vector lock-protected
This commit is contained in:
@@ -371,6 +371,19 @@ int main(int argc, char **argv)
|
||||
config.showHelp = false;
|
||||
|
||||
SetConsoleCtrlHandler(ConsoleCtrlHandlerProc, TRUE);
|
||||
|
||||
// Disable QuickEdit mode so clicking in the console window doesn't freeze
|
||||
// the server process. Without this, any accidental click pauses all threads
|
||||
// that write to stdout until a key is pressed.
|
||||
{
|
||||
HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
DWORD mode = 0;
|
||||
GetConsoleMode(hInput, &mode);
|
||||
mode &= ~ENABLE_QUICK_EDIT_MODE;
|
||||
mode |= ENABLE_EXTENDED_FLAGS;
|
||||
SetConsoleMode(hInput, mode);
|
||||
}
|
||||
|
||||
SetExeWorkingDirectory();
|
||||
|
||||
// Load base settings from server.properties, then override with CLI values when provided
|
||||
|
||||
Reference in New Issue
Block a user