changeset 515:91f5c9dc91c8

fix
author mir3636
date Thu, 21 Feb 2019 18:37:25 +0900
parents 887ebd993b3d
children 1646be890954
files src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java src/main/java/jp/ac/u_ryukyu/treevnc/BroadcastRFBListener.java src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java
diffstat 3 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java	Thu Feb 21 16:52:21 2019 +0900
+++ b/src/main/java/com/glavsoft/rfb/encoding/decoder/ZRLEDecoder.java	Thu Feb 21 18:37:25 2019 +0900
@@ -86,7 +86,7 @@
 						offset += decodePacked(bytes, offset, renderer, paletteSize, tileX, tileY, tileWidth, tileHeight);
 					}
 				}
-				if (rfbProto != null) rfbProto.multicastPut(rect, bytes, prevoffset, offset, tileWidth, tileHeight);
+				if (rfbProto != null && rfbProto.multicastBlocking) rfbProto.multicastPut(rect, bytes, prevoffset, offset, tileWidth, tileHeight);
 				prevoffset = offset;
 			}
 		}
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/BroadcastRFBListener.java	Thu Feb 21 16:52:21 2019 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/BroadcastRFBListener.java	Thu Feb 21 18:37:25 2019 +0900
@@ -83,7 +83,7 @@
 
 		try {
 			DatagramPacket sendPacket = new DatagramPacket(buf.array
-					(), buf.limit(), InetAddress.getByName(TreeRootFinderListener.Ipv6McastAddr), ConnectionParams.DEFAULT_VNC_ROOT_FINDER);
+					(), buf.limit(), InetAddress.getByName(TreeRootFinderListener.Ipv6McastAddr), ConnectionParams.DEFAULT_VNC_BROADCAST);
 			soc.send(sendPacket);
 		} catch (IOException e) {
 			System.out.println("cannot send UpdateRectangle.");
@@ -91,13 +91,12 @@
 		}
 
 		try {
-			DatagramPacket sendPacket1 = new DatagramPacket(buf.array(), buf.limit(), InetAddress.getByName(TreeRootFinderListener.Ipv4McastAddr), ConnectionParams.DEFAULT_VNC_ROOT_FINDER);
+			DatagramPacket sendPacket1 = new DatagramPacket(buf.array(), buf.limit(), InetAddress.getByName(TreeRootFinderListener.Ipv4McastAddr), ConnectionParams.DEFAULT_VNC_BROADCAST);
 			soc.send(sendPacket1);
 		} catch (IOException e) {
 			System.out.println("cannot send UpdateRectangle.");
 			e.printStackTrace();
 		}
-		soc.close();
 	}
 
     public void run() {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Thu Feb 21 16:52:21 2019 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Thu Feb 21 18:37:25 2019 +0900
@@ -80,6 +80,7 @@
     private FramebufferUpdateRectangle c1rect;
     private int c1headerPos;
     private boolean stopBroadcast;
+    public boolean multicastBlocking = true;
 
     public TreeRFBProto(boolean isTreeManager, ViewerInterface viewer) {
         nets.setMyRfb(this);
@@ -656,7 +657,7 @@
 
             if (encoding == EncodingType.ZRLE.getId()
                     || encoding == EncodingType.ZLIB.getId()) {
-                if (true)  {
+                if (multicastBlocking)  {
                     try {
                         zrleeBlocking(dataLen, reader, bytes, rect, context.getPixelFormat().bitsPerPixel/8, bufs, header);
                     } catch (DataFormatException e) {
@@ -798,6 +799,7 @@
                 c1.putLong(counter++);
             c1headerPos = c1.position();
             c1.put(header);
+            header.flip();
             c1.putInt(0);
         } else {
             deflater.deflate(c1, Deflater.SYNC_FLUSH);
@@ -1040,7 +1042,7 @@
     public synchronized void startBroadcast(ReceiverTask receiverTask) {
         BroadcastRFBListener rfbBroadcastListener = viewer.getRfbBroadcastListener();
         rfbBroadcastListener.init(this, receiverTask);
-        if (rfbBroadcastListener.isStopFlag()) {
+        if (!rfbBroadcastListener.isStopFlag()) {
             Thread rfbBroadcast = new Thread(rfbBroadcastListener, "RFBBroadcast");
             rfbBroadcast.start();
         }