# HG changeset patch
# User innparusu
# Date 1442905402 -32400
# Node ID 5a61cbdd83ab8e97853b933cb489d71eb2d40317
# Parent 3673523283299b01e2f4ec5be7538ad516026030
Lock rfb
diff -r 367352328329 -r 5a61cbdd83ab .idea/workspace.xml
--- a/.idea/workspace.xml Fri Sep 18 16:42:47 2015 +0900
+++ b/.idea/workspace.xml Tue Sep 22 16:03:22 2015 +0900
@@ -4,7 +4,6 @@
-
@@ -34,10 +33,10 @@
-
+
-
+
@@ -47,7 +46,7 @@
-
+
@@ -57,7 +56,7 @@
-
+
@@ -67,11 +66,9 @@
-
+
-
-
-
+
@@ -79,7 +76,7 @@
-
+
@@ -89,7 +86,7 @@
-
+
@@ -99,7 +96,7 @@
-
+
@@ -109,9 +106,20 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -119,13 +127,23 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -133,25 +151,25 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -160,43 +178,21 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -205,9 +201,20 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -215,9 +222,13 @@
-
+
-
+
+
+
+
+
@@ -225,9 +236,13 @@
-
+
-
+
+
+
+
+
@@ -242,12 +257,14 @@
-
-
+
+
-
-
-
+
+
+
+
+
@@ -255,9 +272,94 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -265,87 +367,11 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -644,17 +670,17 @@
-
+
-
+
-
+
-
+
@@ -679,7 +705,6 @@
-
@@ -1047,6 +1072,7 @@
+
@@ -1071,7 +1097,7 @@
-
+
@@ -1178,6 +1204,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1206,19 +1245,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1275,9 +1301,27 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1324,7 +1368,7 @@
-
+
@@ -1333,9 +1377,8 @@
-
-
+
@@ -1347,25 +1390,26 @@
-
-
+
+
+
+
-
+
-
+
-
@@ -1442,7 +1486,7 @@
file://$PROJECT_DIR$/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java
- 548
+ 535
@@ -1460,7 +1504,7 @@
file://$PROJECT_DIR$/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java
- 834
+ 821
@@ -1562,20 +1606,14 @@
- file://$PROJECT_DIR$/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java
- 390
-
-
-
-
file://$PROJECT_DIR$/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java
- 191
+ 192
file://$PROJECT_DIR$/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java
- 809
+ 796
@@ -1585,15 +1623,9 @@
-
- file://$PROJECT_DIR$/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java
- 403
-
-
-
file://$PROJECT_DIR$/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java
- 188
+ 187
@@ -1605,7 +1637,7 @@
file://$PROJECT_DIR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
-
-
-
-
-
-
@@ -2330,9 +1912,7 @@
-
-
-
+
@@ -2396,7 +1976,6 @@
-
@@ -2404,7 +1983,6 @@
-
@@ -2429,7 +2007,7 @@
-
+
@@ -2454,7 +2032,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2466,19 +2055,15 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -2486,7 +2071,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2494,74 +2090,35 @@
-
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2580,119 +2137,159 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff -r 367352328329 -r 5a61cbdd83ab src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Fri Sep 18 16:42:47 2015 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java Tue Sep 22 16:03:22 2015 +0900
@@ -22,6 +22,7 @@
import com.glavsoft.rfb.protocol.ProtocolContext;
import com.glavsoft.transport.Reader;
import com.glavsoft.transport.Writer;
+import com.glavsoft.viewer.ConnectionPresenter;
import com.glavsoft.viewer.ViewerInterface;
import com.glavsoft.viewer.swing.ConnectionParams;
@@ -493,24 +494,10 @@
}
}
-
- public synchronized void waitForVNCConnection() {
- while (!readyReconnect) {
- try {
- wait();
- } catch (InterruptedException e) {
- e.printStackTrace();
- System.out.println("interrupt wait for vnc connection.");
- }
- }
- }
-
-
public void sendDesktopSizeChange(short id) {
LinkedList desktopSize = new LinkedList();
int width = context.getFbWidth();
int height = context.getFbHeight();
- byte[] initData = null;
if (filterSingleDisplay) {
originalInitData = createOriginalInitData(singleWidth, singleHeight, context.getRemoteDesktopName());
@@ -936,4 +923,27 @@
}
newClient(previousWriter, previousReader);
}
+
+ /**
+ * Requested server is connected. stop old connection, replace old connection parameter such as
+ * context (PROTOCOL)
+ * start new connection and send INIT_DATA
+ * @param workingProtocol
+ * @param connectionPresenter
+ */
+ public synchronized void newVNCConnection(Protocol workingProtocol, ConnectionPresenter connectionPresenter) {
+ ProtocolContext previousContext = getContext();
+ stopReceiverTask();
+ setProtocolContext(workingProtocol);
+ connectionPresenter.viewer.setConnectionPresenter(connectionPresenter);
+ connectionPresenter.viewer.getConnectionPresenter().addModel("ConnectionParamsModel", connectionPresenter.getConnectionParams());
+ if (previousContext != null && isTreeManager() && hasParent()) {
+ Reader previousReader = previousContext.getReader();
+ Writer previousWriter = previousContext.getWriter();
+ exchangeDirectConnectedServer(previousReader, previousWriter);
+ }
+ enableChildrenTransmission();
+ printNetworkInterface();
+ sendDesktopSizeChange(connectionPresenter.getReconnectingId());
+ }
}
\ No newline at end of file
diff -r 367352328329 -r 5a61cbdd83ab src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java
--- a/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java Fri Sep 18 16:42:47 2015 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/ConnectionPresenter.java Tue Sep 22 16:03:22 2015 +0900
@@ -25,18 +25,13 @@
package com.glavsoft.viewer;
import com.glavsoft.rfb.protocol.Protocol;
-import com.glavsoft.rfb.protocol.ProtocolContext;
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.Model;
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.ScreenChangeRequest;
import jp.ac.u_ryukyu.treevnc.TreeRFBProto;
import java.net.Socket;
@@ -386,21 +381,4 @@
setNeedReconnection(!viewer.noConnection);
startConnection(viewer.settings, viewer.uiSettings, viewer.paramsMask, exchangeSocket);
}
-
- public synchronized void newVNCConnection(Protocol workingProtocol) {
- TreeRFBProto rfb = viewer.getRfb();
- ProtocolContext previousContext = rfb.getContext();
- rfb.stopReceiverTask();
- rfb.setProtocolContext(workingProtocol);
- viewer.setConnectionPresenter(this);
- viewer.getConnectionPresenter().addModel("ConnectionParamsModel", connectionParams);
- if (previousContext != null && rfb.isTreeManager() && rfb.hasParent()) {
- Reader previousReader = previousContext.getReader();
- Writer previousWriter = previousContext.getWriter();
- rfb.exchangeDirectConnectedServer(previousReader, previousWriter);
- }
- rfb.enableChildrenTransmission();
- rfb.printNetworkInterface();
- rfb.sendDesktopSizeChange(reconnectingId);
- }
}
diff -r 367352328329 -r 5a61cbdd83ab src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Fri Sep 18 16:42:47 2015 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Tue Sep 22 16:03:22 2015 +0900
@@ -168,7 +168,7 @@
public void startVNCConnection() {
presenter.showMessage("Handshake established");
- presenter.newVNCConnection(workingProtocol);
+ myRfb.newVNCConnection(workingProtocol, presenter);
ClipboardControllerImpl clipboardController;
if(!myRfb.getCuiVersion())
clipboardController = new ClipboardControllerImpl(workingProtocol, rfbSettings.getRemoteCharsetName());
@@ -178,7 +178,6 @@
rfbSettings.addListener(clipboardController);
if(!myRfb.getCuiVersion())
viewerWindow = viewerWindowFactory.createViewerWindow(workingProtocol, rfbSettings, uiSettings, connectionString, presenter);
- myRfb.setProtocolContext(workingProtocol);
workingProtocol.startNormalHandling(this,viewerWindow.getSurface(), clipboardController, myRfb);
presenter.showMessage("Started");