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;
@@ -82,6 +82,8 @@ public class ClientThread extends Thread
public void run() public void run()
{ {
long starttime = System.currentTimeMillis(); long starttime = System.currentTimeMillis();
try
{
try try
{ {
do do
@@ -96,6 +98,33 @@ public class ClientThread extends Thread
} }
while (true); 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) catch (Exception e)
{ {
_log.warning(e.toString()); _log.warning(e.toString());
@@ -108,7 +137,7 @@ public class ClientThread extends Thread
{ {
saveCharToDisk(_activeChar); saveCharToDisk(_activeChar);
} }
catch (Exception e2) catch (Exception se)
{ {
// empty catch block // empty catch block
} }
@@ -116,7 +145,7 @@ public class ClientThread extends Thread
_connection.close(); _connection.close();
LoginController.getInstance().removeGameServerLogin(getLoginName()); LoginController.getInstance().removeGameServerLogin(getLoginName());
} }
catch (Exception e1) catch (Exception ex)
{ {
try try
{ {
@@ -126,11 +155,46 @@ public class ClientThread extends Thread
LoginController.getInstance().removeGameServerLogin(getLoginName()); LoginController.getInstance().removeGameServerLogin(getLoginName());
throw throwable; throw throwable;
} }
_log.warning(e1.toString()); _log.warning(ex.toString());
LoginController.getInstance().removeGameServerLogin(getLoginName()); 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) public void saveCharToDisk(PlayerInstance cha)
{ {