Mercurial > hg > Applications > AliceVNC
changeset 29:0f964a1ec846
server change request cant receive
author | sugi |
---|---|
date | Sat, 08 Nov 2014 20:26:32 +0900 |
parents | 71dd46e2d706 |
children | d8c6a4c7f16e |
files | src/main/java/jp/ac/u_ryukyu/alicevnc/CheckCurrentInfo.java src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveChangeRequest.java src/main/java/jp/ac/u_ryukyu/alicevnc/StopProxy.java |
diffstat | 3 files changed, 23 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/CheckCurrentInfo.java Sat Nov 08 16:48:36 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/CheckCurrentInfo.java Sat Nov 08 20:26:32 2014 +0900 @@ -1,5 +1,7 @@ package jp.ac.u_ryukyu.alicevnc; +import java.util.ArrayList; + import jp.ac.u_ryukyu.alicevnc.ChangeRequestMessage.MessageType; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; @@ -28,8 +30,21 @@ current.route.remove(last); ods.put(address, "changeRequest", current); + ChangeRequestMessage mes = new ChangeRequestMessage(MessageType.StartNegotiate); + mes.route = new ArrayList<String>(); + for (String s : order.route) { + mes.route.add(s); + } + mes.name = "node0"; + + last = mes.route.size() - 1; + address = mes.route.get(last); + ods.put("changeRequest", order); + mes.route.remove(last); + ods.put(address, "changeRequest", mes); + // update current server info - ods.update("currentServer", order); + //ods.update("currentServer", order); } else { // not allow to change int last = order.route.size() - 1;
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveChangeRequest.java Sat Nov 08 16:48:36 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveChangeRequest.java Sat Nov 08 20:26:32 2014 +0900 @@ -38,10 +38,7 @@ } else { System.out.println("coming Server change request from "+ order.name+" "+order.route.size()); new CheckCurrentInfo(order); // check change Server flag. - order.messageID = MessageType.StartNegotiate.getId(); - order.name = "node0"; - ods.put(info.key, order); - new ReceiveChangeRequest(); + } } } else if (order.messageID == MessageType.StartNegotiate.getId()|| @@ -61,8 +58,8 @@ String address = order.route.get(last); order.route.remove(last); ods.put(address, "changeRequest", order); + new ReceiveChangeRequest(); } - new ReceiveChangeRequest(); } } } \ No newline at end of file
--- a/src/main/java/jp/ac/u_ryukyu/alicevnc/StopProxy.java Sat Nov 08 16:48:36 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/alicevnc/StopProxy.java Sat Nov 08 20:26:32 2014 +0900 @@ -1,6 +1,6 @@ package jp.ac.u_ryukyu.alicevnc; -import com.glavsoft.rfb.protocol.Protocol; +import com.glavsoft.viewer.Viewer; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; @@ -11,14 +11,14 @@ private Receiver info = ids.create(CommandType.TAKE); public StopProxy() { - info.setKey("protocol"); + info.setKey("viewer"); } @Override public void run() { System.out.println("call clean up session"); - Protocol p = info.asClass(Protocol.class); - p.cleanUpSession(); - + Viewer v = info.asClass(Viewer.class); + v.closeApp(); + new ReceiveChangeRequest(); } }