fix: impl shutdown error handling

This commit is contained in:
izzy 2026-03-07 17:40:14 -05:00
parent 8a545f37f0
commit 0a8b0cb406
2 changed files with 51 additions and 24 deletions

View file

@ -151,8 +151,33 @@ ClientConnection::~ClientConnection()
void ClientConnection::tick()
{
if (!done) connection->tick();
connection->flush();
if (done) return;
try
{
connection->tick();
connection->flush();
}
catch (const IOException &e)
{
app.DebugPrintf("IOException - %ls\n", e.information.c_str());
this->done;
}
catch (const RuntimeException &e)
{
app.DebugPrintf("RuntimeException - %ls\n", e.information.c_str());
this->done;
}
catch (const IllegalArgumentException &e)
{
app.DebugPrintf("IllegalArgumentException - %ls\n", e.information.c_str());
this->done;
}
catch (const EOFException &e)
{
app.DebugPrintf("EOFException - %ls\n", e.information.c_str());
this->done;
}
}
INetworkPlayer *ClientConnection::getNetworkPlayer()

View file

@ -583,30 +583,32 @@ int Connection::runRead(void* lpParam)
con->readThreads++;
LeaveCriticalSection(cs);
//try {
try {
MemSect(19);
while (con->running && !con->quitting && ShutdownManager::ShouldRun(ShutdownManager::eConnectionReadThreads))
{
while (con->readTick())
;
MemSect(19);
while (con->running && !con->quitting && ShutdownManager::ShouldRun(ShutdownManager::eConnectionReadThreads))
{
while (con->readTick())
;
// try {
//Sleep(100L);
// TODO - 4J Stu - 1.8.2 changes these sleeps to 2L, but not sure whether we should do that as well
con->m_hWakeReadThread->WaitForSignal(100L);
// try {
//Sleep(100L);
// TODO - 4J Stu - 1.8.2 changes these sleeps to 2L, but not sure whether we should do that as well
con->m_hWakeReadThread->WaitForSignal(100L);
}
MemSect(0);
}
MemSect(0);
/* 4J JEV, removed try/catch
} catch (InterruptedException e) {
}
}
} finally {
synchronized (threadCounterLock) {
readThreads--;
}
} */
catch (EOFException e)
{
app.DebugPrintf("EOFException - %ls\n", e.information.c_str());
con->running = false;
con->quitting = true;
}
catch (IOException e)
{
app.DebugPrintf("IOException - %ls\n", e.information.c_str());
con->running = false;
con->quitting = true;
}
ShutdownManager::HasFinished(ShutdownManager::eConnectionReadThreads);
return 0;