Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 332:6a6653b67bd7
fix bug lostChild and change message panel failed connect death node
author | oc |
---|---|
date | Wed, 04 Feb 2015 17:46:09 +0900 |
parents | 42fcc9419498 |
children | 1be15ac758b4 |
files | src/main/java/com/glavsoft/rfb/protocol/ReceiverTask.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingNetworkConnectionWorker.java |
diffstat | 2 files changed, 17 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- 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."); + } }
--- 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(); }