changeset 517:8401dbe0d583

fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 22 Feb 2019 09:34:10 +0900
parents 1646be890954
children c4d1a275b7d5
files .idea/modules.xml src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/.idea/modules.xml	Thu Feb 21 19:45:56 2019 +0900
+++ b/.idea/modules.xml	Fri Feb 22 09:34:10 2019 +0900
@@ -2,6 +2,7 @@
 <project version="4">
   <component name="ProjectModuleManager">
     <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/modules/TreeVNC.iml" filepath="$PROJECT_DIR$/.idea/modules/TreeVNC.iml" />
       <module fileurl="file://$PROJECT_DIR$/.idea/modules/TreeVNC_main.iml" filepath="$PROJECT_DIR$/.idea/modules/TreeVNC_main.iml" group="TreeVNC" />
       <module fileurl="file://$PROJECT_DIR$/.idea/modules/TreeVNC_test.iml" filepath="$PROJECT_DIR$/.idea/modules/TreeVNC_test.iml" group="TreeVNC" />
       <module fileurl="file://$PROJECT_DIR$/.idea/modules/TreeVNC_viewerSwing.iml" filepath="$PROJECT_DIR$/.idea/modules/TreeVNC_viewerSwing.iml" group="TreeVNC" />
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Thu Feb 21 19:45:56 2019 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Fri Feb 22 09:34:10 2019 +0900
@@ -775,6 +775,7 @@
             CheckDelay.checkDelay(c1, rect.x, rect.y, rect.width, rect.height, System.currentTimeMillis(), EncodingType.CHECK_DELAY);
         c1headerPos = c1.position();
         c1.put(header);
+        header.flip();
         c1.putInt(0);
         c1rect = new FramebufferUpdateRectangle(rect.x, rect.y, 0, 0);
         return;
@@ -787,9 +788,9 @@
         if (c1.remaining() < span || c1rect.x + c1rect.width + tilex >= rect.x + rect.width ) {
             deflater.deflate(c1, Deflater.FULL_FLUSH);
             c1.flip();
-            System.out.println("multicastPut: " + c1rect + " length: " + c1.remaining());
+            System.out.println("multicastPut: " + c1rect + " length: " + (c1.remaining()-c1headerPos-header.limit()));
             try {
-                writeUpdateRectangleWithHeader(c1, c1headerPos, c1.remaining(), c1rect.x, c1rect.y, c1rect.width, c1rect.height);
+                writeUpdateRectangleWithHeader(c1, c1headerPos, c1.remaining()-c1headerPos-header.limit(), c1rect.x, c1rect.y, c1rect.width, c1rect.height);
             } catch (InterruptedException e) {
                 e.printStackTrace();
             }
@@ -829,7 +830,7 @@
             multicastqueue.waitput(bufs);
         byte[] bytes = c1.array();
         System.out.println(" bytes: " + bytes[headerPos + 20] + ", " + bytes[headerPos + 21] + ", " + bytes[headerPos + 22] + ", " + bytes[headerPos + 23]);
-        System.out.println(" bytes: " + bytes[len2 - 4] + ", " + bytes[len2 - 3] + ", " + bytes[len2 - 2] + ", " + bytes[len2 - 1]);
+        System.out.println(" bytes: " + bytes[headerPos+ len2 - 4] + ", " + bytes[headerPos+len2 - 3] + ", " + bytes[headerPos+len2 - 2] + ", " + bytes[headerPos+len2 - 1]);
     }
 
     public LinkedList<ByteBuffer> createCheckDelayHeader(LinkedList<ByteBuffer> checkDelay, ByteBuffer header) {