diff src/alice/topology/node/IncomingConnectionInfo.java @ 258:7f7b3506bff9

client can get connection list setkey(_CLIST);
author sugi
date Sat, 13 Jul 2013 20:55:32 +0900
parents 21bd8af1cf26
children 23e53aaa8720
line wrap: on
line diff
--- a/src/alice/topology/node/IncomingConnectionInfo.java	Tue Jul 09 17:41:18 2013 +0900
+++ b/src/alice/topology/node/IncomingConnectionInfo.java	Sat Jul 13 20:55:32 2013 +0900
@@ -1,5 +1,8 @@
 package alice.topology.node;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import alice.codesegment.CodeSegment;
 import alice.datasegment.CommandType;
 import alice.datasegment.DataSegment;
@@ -9,12 +12,20 @@
 public class IncomingConnectionInfo extends CodeSegment {
 
 	public Receiver hostInfo = ids.create(CommandType.TAKE);
+	private List<String> connectionList;
 	private String absName;
 	private int count;
 	
 	public IncomingConnectionInfo(String absName, int count) {
 		this.absName = absName;
 		this.count = count;
+		this.connectionList = new ArrayList<String>();
+	}
+	
+	public IncomingConnectionInfo(String absName, int count, List<String> connectionList) {
+		this.absName = absName;
+		this.count = count;
+		this.connectionList = connectionList;
 	}
 
 	@Override
@@ -27,8 +38,9 @@
 		HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class);
 		DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port);
 		ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName);
-
-		IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, ++count);
+		connectionList.add(hostInfo.connectionName);
+		ods.update("_CLIST", connectionList);
+		IncomingConnectionInfo cs = new IncomingConnectionInfo(absName, ++count, connectionList);
 		cs.hostInfo.setKey("manager", absName);
 	}