Partial revert to fix EOF exceptions.

This commit is contained in:
MobiusDevelopment
2019-11-25 02:10:41 +00:00
parent deaecd7678
commit 6abc86f7df

View File

@@ -50,16 +50,16 @@ public class ClientThread extends Thread
private String _loginName; private String _loginName;
private PlayerInstance _activeChar; private PlayerInstance _activeChar;
private final int _sessionId; private final int _sessionId;
private final byte[] _cryptkey = new byte[] private final byte[] _cryptkey =
{ {
-108, (byte) 0x94,
53, (byte) 0x35,
0, (byte) 0x00,
0, (byte) 0x00,
-95, (byte) 0xa1,
108, (byte) 0x6c,
84, (byte) 0x54,
-121 (byte) 0x87
}; };
private File _charFolder; private File _charFolder;
private final long _autoSaveTime; private final long _autoSaveTime;
@@ -84,21 +84,84 @@ public class ClientThread extends Thread
long starttime = System.currentTimeMillis(); long starttime = System.currentTimeMillis();
try try
{ {
do try
{ {
if ((_activeChar != null) && (_autoSaveTime < (System.currentTimeMillis() - starttime))) do
{ {
saveCharToDisk(_activeChar); if ((_activeChar != null) && (_autoSaveTime < (System.currentTimeMillis() - starttime)))
starttime = System.currentTimeMillis(); {
saveCharToDisk(_activeChar);
starttime = System.currentTimeMillis();
}
final byte[] decrypt = _connection.getPacket();
_handler.handlePacket(decrypt);
}
while (true);
}
catch (IOException io)
{
try
{
if (_activeChar != null)
{
_activeChar.deleteMe();
try
{
saveCharToDisk(_activeChar);
}
catch (Exception se)
{
// empty catch block
}
}
_connection.close();
}
catch (Exception ioe)
{
_log.warning(ioe.toString());
}
finally
{
LoginController.getInstance().removeGameServerLogin(getLoginName());
}
}
catch (Exception e)
{
_log.warning(e.toString());
try
{
if (_activeChar != null)
{
_activeChar.deleteMe();
try
{
saveCharToDisk(_activeChar);
}
catch (Exception se)
{
// empty catch block
}
}
_connection.close();
LoginController.getInstance().removeGameServerLogin(getLoginName());
}
catch (Exception ex)
{
try
{
}
catch (Throwable throwable)
{
LoginController.getInstance().removeGameServerLogin(getLoginName());
throw throwable;
}
_log.warning(ex.toString());
LoginController.getInstance().removeGameServerLogin(getLoginName());
} }
final byte[] decrypt = _connection.getPacket();
_handler.handlePacket(decrypt);
} }
while (true);
} }
catch (Exception e) catch (Throwable throwable)
{ {
_log.warning(e.toString());
try try
{ {
if (_activeChar != null) if (_activeChar != null)
@@ -108,7 +171,7 @@ public class ClientThread extends Thread
{ {
saveCharToDisk(_activeChar); saveCharToDisk(_activeChar);
} }
catch (Exception e2) catch (Exception se)
{ {
// empty catch block // empty catch block
} }
@@ -116,19 +179,20 @@ public class ClientThread extends Thread
_connection.close(); _connection.close();
LoginController.getInstance().removeGameServerLogin(getLoginName()); LoginController.getInstance().removeGameServerLogin(getLoginName());
} }
catch (Exception e1) catch (Exception e)
{ {
try try
{ {
} }
catch (Throwable throwable) catch (Throwable t)
{ {
LoginController.getInstance().removeGameServerLogin(getLoginName()); LoginController.getInstance().removeGameServerLogin(getLoginName());
throw throwable; throw t;
} }
_log.warning(e1.toString()); _log.warning(e.toString());
LoginController.getInstance().removeGameServerLogin(getLoginName()); LoginController.getInstance().removeGameServerLogin(getLoginName());
} }
throw throwable;
} }
} }