mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
Fixed bloated connection errors in logs;
Fixed that data update tasks runs after disconnect;
This commit is contained in:
parent
f81142459d
commit
fe9c3fbae8
3 changed files with 18 additions and 5 deletions
|
@ -1416,11 +1416,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
// USER mode, e.g. user plays and got disconnect
|
||||
LOGGER.info("Disconnected from user mode");
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
SessionHandler.disconnect(false); // user already disconnected, can't do any online actions like quite chat
|
||||
setConnectButtonText(NOT_CONNECTED_TEXT);
|
||||
disableButtons();
|
||||
hideGames();
|
||||
hideTables();
|
||||
SessionHandler.disconnect(false);
|
||||
if (askToReconnect) {
|
||||
UserRequestMessage message = new UserRequestMessage("Connection lost", "The connection to server was lost. Reconnect to " + MagePreferences.getLastServerAddress() + "?");
|
||||
message.setButton1("No", null);
|
||||
|
|
|
@ -513,6 +513,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
public void cleanUp() {
|
||||
saveGuiSettings();
|
||||
chatPanelMain.cleanUp();
|
||||
stopTasks();
|
||||
}
|
||||
|
||||
public void changeGUISize() {
|
||||
|
|
|
@ -1583,12 +1583,24 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
|
||||
private void handleThrowable(Throwable t) {
|
||||
logger.fatal("Communication error", t);
|
||||
|
||||
// ignore interrupted exceptions -- it's connection problem or user's close
|
||||
if (t instanceof InterruptedException) {
|
||||
//logger.error("Connection error: was interrupted", t);
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
|
||||
// Probably this can cause hanging the client under certain circumstances as the disconnect method is synchronized
|
||||
// so check if it's needed
|
||||
// disconnect(true);
|
||||
if (t instanceof RuntimeException) {
|
||||
RuntimeException re = (RuntimeException) t;
|
||||
if (t.getCause() instanceof InterruptedException) {
|
||||
//logger.error("Connection error: was interrupted by runtime exception", t.getCause());
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
logger.fatal("Connection error: other", t);
|
||||
}
|
||||
|
||||
private void handleMageException(MageException ex) {
|
||||
|
|
Loading…
Reference in a new issue