mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
fix: impl shutdown error handling
This commit is contained in:
parent
8a545f37f0
commit
0a8b0cb406
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue