# HG changeset patch # User oc # Date 1400760654 -32400 # Node ID 8f4c45c1b396f23ea188addeb2a543356828c9e7 # Parent 44f5cdc63a76c27f17d48515d8e5b99545ea47b6 add serial number to desktop size encoding packet. diff -r 44f5cdc63a76 -r 8f4c45c1b396 src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Thu May 22 19:45:59 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Thu May 22 21:10:54 2014 +0900 @@ -27,14 +27,16 @@ //final static String versionMsg_3_855 = "RFB 003.855\n"; final static String versionMsg_3_856 = "RFB 003.856\n"; private int clients; - protected MulticastQueue> multicastqueue = new MulticastQueue>(); + public MulticastQueue> multicastqueue = new MulticastQueue>(); private RequestScreenThread rThread; private boolean proxyFlag = true; private EchoClient echo; private String proxyAddr; public int acceptPort; protected boolean readyReconnect = false; - private boolean cuiVersion; + private boolean cuiVersion; + private long counter = 0; // packet serial number + public MyRfbProto() { rThread = new RequestScreenThread(this); @@ -298,7 +300,6 @@ } else { // Send dummy data os.write(initData); - } } @@ -420,7 +421,16 @@ int width = context.getFbWidth(); int height = context.getFbHeight(); desktopSize.add(new UpdateRectangleMessage(0,0, width, height, EncodingType.DESKTOP_SIZE).getMessage()); + multicastqueue.put(desktopSize); } + + + public void addSerialNumber(LinkedList bufs) { + ByteBuffer serialNum = multicastqueue.allocate(8); + serialNum.putLong(counter++); + serialNum.flip(); + bufs.addFirst(serialNum); + } } diff -r 44f5cdc63a76 -r 8f4c45c1b396 src/main/java/jp/ac/u_ryukyu/treevnc/UpdateRectangleMessage.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/UpdateRectangleMessage.java Thu May 22 19:45:59 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/UpdateRectangleMessage.java Thu May 22 21:10:54 2014 +0900 @@ -7,7 +7,7 @@ public class UpdateRectangleMessage { - private ByteBuffer msg = ByteBuffer.allocate(16).order(ByteOrder.LITTLE_ENDIAN); + private ByteBuffer msg = ByteBuffer.allocate(16).order(ByteOrder.BIG_ENDIAN); public UpdateRectangleMessage(int i, int j, int width, int height, EncodingType desktopSize) { diff -r 44f5cdc63a76 -r 8f4c45c1b396 src/main/java/jp/ac/u_ryukyu/treevnc/server/MyRfbProtoProxy.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/MyRfbProtoProxy.java Thu May 22 19:45:59 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/MyRfbProtoProxy.java Thu May 22 21:10:54 2014 +0900 @@ -45,7 +45,6 @@ private ServerSocket servSock; protected int acceptPort; - // private byte initData[]; private LinkedList cliListTmp; private LinkedList cliList; boolean createBimgFlag; @@ -57,13 +56,13 @@ private Inflater inflater = new Inflater(); private Deflater deflater = new Deflater(); - private RequestScreenThread rThread; + public RequestScreenThread rThread; private Thread requestThread; private int rangeX = 256; // screenRange XPosition private int rangeY = 256; // screenRange YPosition // private int rangeWidth = 512; // screenRange Width private int rangeHeight = 256; // screenRange Height - private int counter = 0; // add serialnum. + public MyRfbProtoProxy() { rThread = new RequestScreenThread(this); @@ -313,13 +312,7 @@ blen.flip(); bufs.addFirst(blen); bufs.addFirst(header); - - - ByteBuffer serialNum = multicastqueue.allocate(8); - serialNum.putLong(counter++); - serialNum.flip(); - bufs.addFirst(serialNum); - + addSerialNumber(bufs); multicastqueue.put(bufs); return; diff -r 44f5cdc63a76 -r 8f4c45c1b396 src/main/java/jp/ac/u_ryukyu/treevnc/server/RequestScreenThread.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/RequestScreenThread.java Thu May 22 19:45:59 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/RequestScreenThread.java Thu May 22 21:10:54 2014 +0900 @@ -5,7 +5,7 @@ import com.glavsoft.rfb.protocol.Protocol; public class RequestScreenThread implements Runnable { - MyRfbProto rfb; + public MyRfbProto rfb; Protocol protocol; public RequestScreenThread(MyRfbProto _rfb) {