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 PlayerInstance _activeChar;
private final int _sessionId;
private final byte[] _cryptkey = new byte[]
private final byte[] _cryptkey =
{
-108,
53,
0,
0,
-95,
108,
84,
-121
(byte) 0x94,
(byte) 0x35,
(byte) 0x00,
(byte) 0x00,
(byte) 0xa1,
(byte) 0x6c,
(byte) 0x54,
(byte) 0x87
};
private File _charFolder;
private final long _autoSaveTime;
@@ -82,6 +82,8 @@ public class ClientThread extends Thread
public void run()
{
long starttime = System.currentTimeMillis();
try
{
try
{
do
@@ -96,6 +98,33 @@ public class ClientThread extends Thread
}
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());
@@ -108,7 +137,7 @@ public class ClientThread extends Thread
{
saveCharToDisk(_activeChar);
}
catch (Exception e2)
catch (Exception se)
{
// empty catch block
}
@@ -116,7 +145,7 @@ public class ClientThread extends Thread
_connection.close();
LoginController.getInstance().removeGameServerLogin(getLoginName());
}
catch (Exception e1)
catch (Exception ex)
{
try
{
@@ -126,11 +155,46 @@ public class ClientThread extends Thread
LoginController.getInstance().removeGameServerLogin(getLoginName());
throw throwable;
}
_log.warning(e1.toString());
_log.warning(ex.toString());
LoginController.getInstance().removeGameServerLogin(getLoginName());
}
}
}
catch (Throwable throwable)
{
try
{
if (_activeChar != null)
{
_activeChar.deleteMe();
try
{
saveCharToDisk(_activeChar);
}
catch (Exception se)
{
// empty catch block
}
}
_connection.close();
LoginController.getInstance().removeGameServerLogin(getLoginName());
}
catch (Exception e)
{
try
{
}
catch (Throwable t)
{
LoginController.getInstance().removeGameServerLogin(getLoginName());
throw t;
}
_log.warning(e.toString());
LoginController.getInstance().removeGameServerLogin(getLoginName());
}
throw throwable;
}
}
public void saveCharToDisk(PlayerInstance cha)
{