# HG changeset patch # User innparusu # Date 1443520005 -32400 # Node ID 704ac9e79e25cbaa37f30bd1073051e3314ba46f # Parent a8610fab6861ea7a47f473ee4a215b36baddbfa8 Call startVNCConnectionWithSocket for directedServerChangeReqeust diff -r a8610fab6861 -r 704ac9e79e25 .idea/workspace.xml --- a/.idea/workspace.xml Sat Sep 26 17:58:50 2015 +0900 +++ b/.idea/workspace.xml Tue Sep 29 18:46:45 2015 +0900 @@ -2,8 +2,12 @@ - + + + + + @@ -21,50 +25,53 @@ + + + - + - + - - + + + + + + + + + + + + + + - - + + - - + + - - - - - - - - - - - - - + @@ -74,8 +81,62 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -84,49 +145,37 @@ - + - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -138,10 +187,22 @@ - - + + - + + + + + + + + + + + + + @@ -151,8 +212,31 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -161,8 +245,8 @@ - - + + @@ -171,7 +255,7 @@ - + @@ -181,9 +265,22 @@ - + - + + + + + + + + + + + + + + @@ -191,42 +288,23 @@ - - + + - - - - - - - - - - - - - - + - - - - - - - - - - - + + + + + @@ -517,32 +595,29 @@ - - - @@ -567,8 +642,6 @@ - - @@ -922,6 +995,8 @@ + + @@ -1002,26 +1077,6 @@ - + + + - + + + - - - + + - - - @@ -1281,6 +1366,9 @@ + @@ -1453,14 +1541,8 @@ @@ -1491,69 +1585,92 @@ - + - - + + + + + + + + + + - + - + + + + + - + - + + + + + + + + + + + + - + - + - + - + - + - + @@ -1564,14 +1681,14 @@ - + - + @@ -1579,7 +1696,7 @@ - + @@ -1587,64 +1704,42 @@ - + - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + @@ -1654,28 +1749,21 @@ - + - + - - - - - - - - + @@ -1685,69 +1773,42 @@ - - - - - - - - - - - - - - - - - - - - + - + - + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - + @@ -1760,7 +1821,7 @@ - + @@ -1768,7 +1829,7 @@ - + @@ -1776,7 +1837,7 @@ - + @@ -1784,136 +1845,270 @@ - + - - - - - - - - - + + + + + - + - - - - - - - - - + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - - - - - - - - - - + + + + + - + + + + + + + + + + + + + + + + + - - + + - - + + + + + + + + + + - + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a8610fab6861 -r 704ac9e79e25 src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Sat Sep 26 17:58:50 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Tue Sep 29 18:46:45 2015 +0900 @@ -903,9 +903,9 @@ /** * server change to directed connected server - * server mayble on the diffrent network + * server maybe on the different network * so can not in whereToConnect message - * reuse dynamic connect sorcket us a new client + * reuse dynamic connect socket us a new client * reother server exchange socket when serverChangeRequest with id -1 * @param previousReader * @param previousWriter diff -r a8610fab6861 -r 704ac9e79e25 src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java --- a/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java Sat Sep 26 17:58:50 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java Tue Sep 29 18:46:45 2015 +0900 @@ -24,15 +24,15 @@ package com.glavsoft.viewer; -import com.glavsoft.rfb.protocol.Protocol; import com.glavsoft.rfb.protocol.ProtocolSettings; +import com.glavsoft.transport.Reader; +import com.glavsoft.transport.Writer; import com.glavsoft.utils.Strings; import com.glavsoft.viewer.mvp.Presenter; import com.glavsoft.viewer.mvp.View; import com.glavsoft.viewer.swing.*; import com.glavsoft.viewer.swing.gui.ConnectionView; import com.glavsoft.viewer.swing.gui.ConnectionsHistory; -import jp.ac.u_ryukyu.treevnc.TreeRFBProto; import java.net.Socket; import java.util.logging.Logger; @@ -92,7 +92,7 @@ logger = Logger.getLogger(getClass().getName()); } - public void startConnection(ProtocolSettings rfbSettings, UiSettings uiSettings, int paramSettingsMask, boolean exchangeSocket) + public void startConnection(ProtocolSettings rfbSettings, UiSettings uiSettings, int paramSettingsMask, boolean exchangeSocket, Reader is, Writer os) throws IllegalStateException { this.rfbSettings = rfbSettings; this.uiSettings = uiSettings; @@ -107,7 +107,7 @@ } if (exchangeSocket) { - rfbConnectionWorker.startVNCConnection(); + rfbConnectionWorker.startVNCConnectionWithSocket(is, os); return; } @@ -357,7 +357,7 @@ return rfbConnectionWorker.getSocket(); } - public void startVNCConnection(Viewer viewer, boolean exchangeSocket) { + public void startVNCConnection(Viewer viewer, boolean exchangeSocket, Reader is, Writer os) { this.viewer = viewer; final boolean hasJsch = viewer.checkJsch(); ConnectionView connectionView = new ConnectionView( @@ -379,6 +379,6 @@ setConnectionWorkerFactory( new SwingConnectionWorkerFactory(connectionView.getFrame(), viewer.passwordFromParams, this, viewerWindowFactory, viewer.myRfb)); setNeedReconnection(!viewer.noConnection); - startConnection(viewer.settings, viewer.uiSettings, viewer.paramsMask, exchangeSocket); + startConnection(viewer.settings, viewer.uiSettings, viewer.paramsMask, exchangeSocket, is, os); } } diff -r a8610fab6861 -r 704ac9e79e25 src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java --- a/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Sat Sep 26 17:58:50 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Tue Sep 29 18:46:45 2015 +0900 @@ -143,7 +143,7 @@ connectionPresenter.setConnectionWorkerFactory( new SwingConnectionWorkerFactory(null, passwordFromParams, connectionPresenter, null, myRfb)); connectionPresenter.setCuiVersion(true); - connectionPresenter.startConnection(settings, uiSettings, paramsMask, false); + connectionPresenter.startConnection(settings, uiSettings, paramsMask, false, null, null); } @Override diff -r a8610fab6861 -r 704ac9e79e25 src/viewer_swing/java/com/glavsoft/viewer/RfbConnectionWorker.java --- a/src/viewer_swing/java/com/glavsoft/viewer/RfbConnectionWorker.java Sat Sep 26 17:58:50 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/RfbConnectionWorker.java Tue Sep 29 18:46:45 2015 +0900 @@ -25,6 +25,8 @@ package com.glavsoft.viewer; import com.glavsoft.rfb.protocol.ProtocolSettings; +import com.glavsoft.transport.Reader; +import com.glavsoft.transport.Writer; import com.glavsoft.viewer.swing.SwingViewerWindow; import java.net.Socket; @@ -44,6 +46,8 @@ void startVNCConnection(); + void startVNCConnectionWithSocket(Reader is, Writer os); + SwingViewerWindow getViewer(); Socket getSocket(); diff -r a8610fab6861 -r 704ac9e79e25 src/viewer_swing/java/com/glavsoft/viewer/Viewer.java --- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sat Sep 26 17:58:50 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Tue Sep 29 18:46:45 2015 +0900 @@ -223,7 +223,7 @@ connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive); connectionPresenter.setNoConnection(noConnection); connectionPresenter.addModel("ConnectionParamsModel", connectionParams); - connectionPresenter.startVNCConnection(this, false); + connectionPresenter.startVNCConnection(this, false, null, null); } @Override @@ -327,14 +327,14 @@ new Thread(new Runnable() { @Override public void run() { - connectionPresenter.startVNCConnection(v, false); + connectionPresenter.startVNCConnection(v, false, null, null); } }, "ServerChangeThread").start(); } public void changeToDirectConnectedServer(String hostName, Reader is, Writer os) { final ConnectionPresenter connectionPresenter = createNewConnectionPresenter(hostName, (short)-1); - connectionPresenter.startVNCConnection(this, true); + connectionPresenter.startVNCConnection(this, true, is, os); }; private ConnectionPresenter createNewConnectionPresenter(String hostName, short newVNCServerId) { diff -r a8610fab6861 -r 704ac9e79e25 src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java --- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Sat Sep 26 17:58:50 2015 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Tue Sep 29 18:46:45 2015 +0900 @@ -159,6 +159,7 @@ } } + @Override public void startVNCConnection() { presenter.showMessage("Handshake established"); myRfb.newVNCConnection(workingProtocol, presenter); @@ -185,6 +186,14 @@ } @Override + public void startVNCConnectionWithSocket (Reader is, Writer os) { + workingProtocol = new Protocol(is, os, + new PasswordChooser(connectionString, parentWindow, this), + rfbSettings, myRfb); + startVNCConnection(); + } + + @Override public void rfbSessionStopped(final String reason) { if (workingProtocol != null) { workingProtocol.cleanUpSession();