@@ -279,24 +279,9 @@ private void startIce() {
279279 * Will then reinitiate ICE
280280 */
281281 public synchronized void onConnectionLost () {
282- if (peer .isClosing ()) {
283- log .warn (getLogPrefix () + "Peer not connected anymore, aborting onConnectionLost of ICE" );
284- return ;
285- }
286-
287- if (peer .getGameSession ().isGameEnded ()) {
288- log .warn ("GAME ENDED, ABORTING onConnectionLost of ICE for peer " + getLogPrefix ());
289- return ;
290- }
291-
292- if (iceState == DISCONNECTED ) {
293- return ;//TODO: will this kill the life cycle?
294- }
295-
296282 IceState previousState = getIceState ();
297283
298284 if (listenerThread != null ) {
299- // listenerThread.stop();//TODO what if cancelled during sending TO FA???
300285 listenerThread .interrupt ();
301286 listenerThread = null ;
302287 }
@@ -325,6 +310,21 @@ public synchronized void onConnectionLost() {
325310
326311 debug ().peerStateChanged (this .peer );
327312
313+ if (peer .isClosing ()) {
314+ log .warn (getLogPrefix () + "Peer not connected anymore, aborting onConnectionLost of ICE" );
315+ return ;
316+ }
317+
318+ if (peer .getGameSession ().isGameEnded ()) {
319+ log .warn (getLogPrefix () + "GAME ENDED, ABORTING onConnectionLost of ICE for peer " );
320+ return ;
321+ }
322+
323+ if (iceState == DISCONNECTED ) {
324+ log .warn (getLogPrefix () + "Lost connection, albeit already in ice state disconnected" );
325+ return ;//TODO: will this kill the life cycle?
326+ }
327+
328328 if (previousState == CONNECTED ) {
329329 TrayIcon .showMessage ("Reconnecting to " + this .peer .getRemoteLogin () + " (connection lost)" );
330330 }
0 commit comments