diff src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java @ 239:d655db005535

create sendCheckDelay Socket.
author oc
date Sat, 11 Oct 2014 23:46:22 +0900
parents 0815ed7f54a7
children 7310e7d7a45f
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Sat Oct 11 14:15:48 2014 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeRFBProto.java	Sat Oct 11 23:46:22 2014 +0900
@@ -65,6 +65,7 @@
     private String vncInterface;
     private int i;
     public LinkedList<TreeVNCNode> nodeList;
+    private SendCheckDelay sendCheckDelay;
 
 
     public TreeRFBProto(boolean isTreeManager) {
@@ -182,6 +183,10 @@
                                 int nodeNum = getNodeNum(port, address);
                                 Long delay = System.currentTimeMillis() - time;
                                 System.out.println("nodeNum" + nodeNum + ", delay = " + delay);
+                                
+                                // checkNodeNum();
+                                // readSendData(check);
+                                
                             }
                         } else if (b[0] == ClientToServerMessage.SERVER_CHANGE_REQUEST) {
                             ClientToServerMessage sc = new ClientToServerMessage() {
@@ -226,13 +231,13 @@
                 writerRunning.set(1);
                 try {
                     requestThreadNotify();
-
+                    
                     // after this, we discard upward packet.
-                    new Thread(reader, "upward-packet-processing").start(); 
-
+                    new Thread(reader, "upward-packet-processing").start();
+                    
                     for (;;) {
                         LinkedList<ByteBuffer> bufs = c.poll();
-
+                        
                         int inputIndex = 0;
                         ByteBuffer header = bufs.get(inputIndex);
                         if (header == null)
@@ -567,7 +572,11 @@
         header.limit(16);
         if (header.get(0) == FramebufferUpdate) {
             int encoding = header.getInt(12);
+            
+//            sendCheckDelay.run();
+            
 
+            /*
             if(isTreeManager()) {
                 if (i%20 == 0) {
                     LinkedList<ByteBuffer> checkdelay = new LinkedList<ByteBuffer>();
@@ -577,6 +586,7 @@
                     multicastqueue.put(checkdelay);
                 } i++;
             }
+            */
 
             if (encoding == EncodingType.ZRLE.getId()
                     || encoding == EncodingType.ZLIB.getId()) {
@@ -704,8 +714,13 @@
         startTreeVncCommandListener();
         if(isTreeManager() && firstTime) {
             getCast = new TreeRootFinderListener(v);
-            Thread thread = new Thread(getCast, "tree-root-find-listener");
-            thread.start();
+            Thread treeRootFindThread = new Thread(getCast, "tree-root-find-listener");
+            treeRootFindThread.start();
+            /*
+            sendCheckDelay = new SendCheckDelay();
+            Thread sendCheckDelayThread = new Thread(sendCheckDelay, "send-check-delay");
+            sendCheckDelayThread.start();
+            */
             firstTime = false;
         }
     }