# HG changeset patch # User oc # Date 1423039569 -32400 # Node ID 6a6653b67bd796ae7bb6cb5248d8ef65758a7ae0 # Parent 42fcc9419498178fe27f323857287e167ccd1114 fix bug lostChild and change message panel failed connect death node diff -r 42fcc9419498 -r 6a6653b67bd7 src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java --- a/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Tue Feb 03 12:31:48 2015 +0900 +++ b/src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java Wed Feb 04 17:46:09 2015 +0900 @@ -44,6 +44,7 @@ import java.util.TimerTask; import java.util.logging.Logger; +import com.glavsoft.viewer.ViewerInterface; import jp.ac.u_ryukyu.treevnc.*; @@ -155,19 +156,15 @@ } catch (TransportException e) { logger.severe("Close session: " + e.getMessage()); if(!rfb.isTreeManager() && !(rfb.getTerminationType())) { - System.out.println("task stop"); - TreeVncProtocol echo = new TreeVncProtocol(rfb.getConnectionParam().getHostName(), rfb.getConnectionParam().getPort()); - int counter = 3; - while(counter-- > 0) { - try { - if (rfb.isLeader()) { -// echo.lostParent(rfb.getMyAddress(),rfb.getAcceptPort()); - } - break; - } catch (Exception e1) { - logger.severe("Cannot send lostHost: " + e1.getMessage()); - sleep(3000); - } + System.out.println("death parent node, wait connect new parent node."); + // close viewer + ViewerInterface viewer = rfb.getViewer(); + viewer.setVisible(false); + try { + // clean DataInputStream + reader.close(); + } catch (TransportException e1) { + e1.printStackTrace(); } } stopTask(); @@ -201,7 +198,7 @@ Thread.sleep(i); } catch (InterruptedException e) { // nothing. - System.out.println("any thread has interrupted the current thread."); + } } diff -r 42fcc9419498 -r 6a6653b67bd7 src/viewer_swing/java/com/glavsoft/viewer/swing/SwingNetworkConnectionWorker.java --- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingNetworkConnectionWorker.java Tue Feb 03 12:31:48 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingNetworkConnectionWorker.java Wed Feb 04 17:46:09 2015 +0900 @@ -130,18 +130,9 @@ presenter.connectionFailed(); } catch (ExecutionException e) { - // lostparent + // wait new connectTo System.out.println("lost parent"); - TreeVncProtocol echo = new TreeVncProtocol(connectionParams.getHostName(), connectionParams.getPortNumber()); - int counter = 3; - while(counter-- > 0) { - try { - echo.lostParent(rfb.getMyAddress(),rfb.getAcceptPort()); - break; - } catch (Exception e1) { - logger.severe("Cannot send lostHost: " + e1.getMessage()); - } - } + String errorMessage = null; @@ -178,7 +169,10 @@ errorMessage = "Couldn't connect to '" + formatHostString(connectionParams.hostName) + ":" + connectionParams.getPortNumber() + "':\n" + throwable.getMessage(); } - presenter.showConnectionErrorDialog(errorMessage); + + String message = "please waiting connect to new node \n \n" + errorMessage; + // show error panel + presenter.showConnectionErrorDialog(message); presenter.clearMessage(); presenter.connectionFailed(); }