mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08: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
|
// USER mode, e.g. user plays and got disconnect
|
||||||
LOGGER.info("Disconnected from user mode");
|
LOGGER.info("Disconnected from user mode");
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
SessionHandler.disconnect(false); // user already disconnected, can't do any online actions like quite chat
|
||||||
setConnectButtonText(NOT_CONNECTED_TEXT);
|
setConnectButtonText(NOT_CONNECTED_TEXT);
|
||||||
disableButtons();
|
disableButtons();
|
||||||
hideGames();
|
hideGames();
|
||||||
hideTables();
|
hideTables();
|
||||||
SessionHandler.disconnect(false);
|
|
||||||
if (askToReconnect) {
|
if (askToReconnect) {
|
||||||
UserRequestMessage message = new UserRequestMessage("Connection lost", "The connection to server was lost. Reconnect to " + MagePreferences.getLastServerAddress() + "?");
|
UserRequestMessage message = new UserRequestMessage("Connection lost", "The connection to server was lost. Reconnect to " + MagePreferences.getLastServerAddress() + "?");
|
||||||
message.setButton1("No", null);
|
message.setButton1("No", null);
|
||||||
|
|
|
||||||
|
|
@ -513,6 +513,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
public void cleanUp() {
|
public void cleanUp() {
|
||||||
saveGuiSettings();
|
saveGuiSettings();
|
||||||
chatPanelMain.cleanUp();
|
chatPanelMain.cleanUp();
|
||||||
|
stopTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeGUISize() {
|
public void changeGUISize() {
|
||||||
|
|
|
||||||
|
|
@ -1583,12 +1583,24 @@ public class SessionImpl implements Session {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleThrowable(Throwable t) {
|
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
|
if (t instanceof RuntimeException) {
|
||||||
// so check if it's needed
|
RuntimeException re = (RuntimeException) t;
|
||||||
// disconnect(true);
|
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) {
|
private void handleMageException(MageException ex) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue