diff --git a/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java b/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java index c2dea73..b038668 100644 --- a/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java +++ b/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java @@ -279,24 +279,9 @@ private void startIce() { * Will then reinitiate ICE */ public synchronized void onConnectionLost() { - if(peer.isClosing()) { - log.warn(getLogPrefix() + "Peer not connected anymore, aborting onConnectionLost of ICE"); - return; - } - - if(peer.getGameSession().isGameEnded()) { - log.warn("GAME ENDED, ABORTING onConnectionLost of ICE for peer " + getLogPrefix()); - return; - } - - if (iceState == DISCONNECTED) { - return;//TODO: will this kill the life cycle? - } - IceState previousState = getIceState(); if (listenerThread != null) { -// listenerThread.stop();//TODO what if cancelled during sending TO FA??? listenerThread.interrupt(); listenerThread = null; } @@ -325,6 +310,21 @@ public synchronized void onConnectionLost() { debug().peerStateChanged(this.peer); + if(peer.isClosing()) { + log.warn(getLogPrefix() + "Peer not connected anymore, aborting onConnectionLost of ICE"); + return; + } + + if(peer.getGameSession().isGameEnded()) { + log.warn(getLogPrefix() + "GAME ENDED, ABORTING onConnectionLost of ICE for peer "); + return; + } + + if (iceState == DISCONNECTED) { + log.warn(getLogPrefix() + "Lost connection, albeit already in ice state disconnected"); + return;//TODO: will this kill the life cycle? + } + if (previousState == CONNECTED) { TrayIcon.showMessage("Reconnecting to " + this.peer.getRemoteLogin() + " (connection lost)"); }