diff rep/SessionManager.java @ 23:01657c033761

*** empty log message ***
author pin
date Thu, 08 Nov 2007 17:19:45 +0900 (2007-11-08)
parents 850a9cc4963a
children 7012a944e58f
line wrap: on
line diff
--- a/rep/SessionManager.java	Thu Nov 08 15:51:43 2007 +0900
+++ b/rep/SessionManager.java	Thu Nov 08 17:19:45 2007 +0900
@@ -33,7 +33,7 @@
 	private SessionManagerList smList;
 	private String myHost;
 	private boolean isMaster = true;
-	private EditorList editorList;
+	private EditorList  editorList;
 	//private SocketChannel sessionchannel;
 	//private boolean co;
 	public SessionManager(int port) {
@@ -62,6 +62,7 @@
 		
 		sessionlist = new SessionList();
 		smList = new SessionManagerList();
+		editorList = new EditorList();
 		
 		while(true){
 			selector.select();
@@ -120,14 +121,17 @@
 		if(repCmd == null) return;
 		switch(repCmd.cmd){
 		case REP.SMCMD_JOIN:
-			editorList.addEditor(repCmd);
 			if(isMaster){
-				sendJoinAck(channel, repCmd);
+				int eid = editorList.addEditor(channel, repCmd);
+				repCmd.setEID(eid);
+				editorList.sendJoinAck(channel, repCmd);
 			}else{
+				editorList.addEditor(channel);
 				smList.sendJoin(repCmd);
 			}
 			break;
 		case REP.SMCMD_JOIN_ACK:
+				editorList.setEID(repCmd);
 				editorList.sendJoinAck(repCmd);
 			break;
 		case REP.SMCMD_PUT:
@@ -199,7 +203,8 @@
 	}
 
 	private void sendJoinAck(SocketChannel channel, REPCommand repCmd) {
-		int eid = sessionlist.getNumberOfEditor();	//eid���擾
+		//int eid = sessionlist.getNumberOfEditor();	//eid���擾
+		int eid = editorList.addEditor(channel, repCmd);
 		sessionmanagerGUI.setComboEditor(eid, channel);		//ComboBox��Editor��lj�
 		repCmd.setEID(eid);							//eid�����肵�āA
 		repCmd.setCMD(REP.SMCMD_JOIN_ACK);