diff src/myVncProxy/AcceptClient.java @ 171:ffc16faf011a

merge
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Fri, 21 Oct 2011 17:02:00 +0900
parents 57904d72fc09 1c0af90f7f59
children 54ad8e0654b5
line wrap: on
line diff
--- a/src/myVncProxy/AcceptClient.java	Fri Oct 21 16:40:47 2011 +0900
+++ b/src/myVncProxy/AcceptClient.java	Fri Oct 21 17:02:00 2011 +0900
@@ -6,7 +6,7 @@
 import java.net.*;
 import java.util.*;
 
-public class AcceptClient extends Thread {
+public class AcceptClient {
 	int counter = 0, parentnum = 0/* 落ちたときの親の番号をカウントするためのもの */;
 	LinkedList<String> ls = new LinkedList<String>();
 	boolean runflag = false;
@@ -19,6 +19,7 @@
 	int intv_time = 100;
 	
 
+
 	public AcceptClient(String name) {
 		this.name = name;
 	}
@@ -71,12 +72,6 @@
 		ls.add(Integer.parseInt(port), ls.getLast());
 		ls.removeLast();
 	}
-	
-	void listupdate(String port,String myaddr) {
-		ls.remove(Integer.parseInt(port));
-		ls.add(Integer.parseInt(port), myaddr);
-		ls.removeLast();
-	}
 
 	void outputStream(PrintStream os, String request, String parentnum,
 			String treenum, String leaderflag) {
@@ -108,12 +103,12 @@
 	}
 
 	String decisionLeader(int counter, int treebranch) {
-		if(counter == 1) 
+		if ((counter - 1) % treebranch == 1) { // children in most young treenum
+												// have leaderflag 1 other 0
+			return "0";
+		} else {
 			return "1";
-		if ((counter - 1) % treebranch == 1)// children in most young treenum
-			return "0";
-		else
-			return "1";
+		}
 	}
 	
 	String getMyAddress () throws UnknownHostException {