diff rep/SessionManager.java @ 167:3dc194f5e28f

*** empty log message ***
author pin
date Thu, 28 Aug 2008 18:44:05 +0900
parents 3841cc75b808
children 2974db051dd8
line wrap: on
line diff
--- a/rep/SessionManager.java	Thu Aug 28 18:16:23 2008 +0900
+++ b/rep/SessionManager.java	Thu Aug 28 18:44:05 2008 +0900
@@ -348,35 +348,32 @@
 			//マージの処理と次のエディタへコマンドを送信する処理
 			session.translate(channel, receivedCommand);
 			
-			Editor editor = getEditor(channel);
+			//マージ中は前のエディタからのコマンドを受信しない
+			Editor editor = session.getEditor(channel);
+			Editor prevEditor = session.getPrevEditor(editor);
+			
+			if(editor.isFinished){
+				set
+			}
+			
 			if(editor.isMerging()){
 				//Handlerを切り替える
-				setMergeState(channel, selector);
+				setMergeState(prevEditor.getChannel(), session.getSID());
 			}
 		}
 		break;
 		}
 	}
 
-	private void setMergeState(REPSocketChannel<REPCommand> channel, Selector selector2) {
-		SelectionKey key = channel.keyFor(selector2);
-		key.attach(new REPHandlerInMerge(this));
+	private void setMergeState(REPSocketChannel<REPCommand> channel, int sid) {
+		SelectionKey key = channel.keyFor(selector);
+		key.attach(new REPHandlerInMerge(sid, this));
 	}
 
 	private Editor getEditor(String hostport) {
 		return null;
 	}
 
-	private Editor getEditor(REPSocketChannel<REPCommand> channel) {
-		// TODO Auto-generated method stub
-		for(Editor editor : editorList){
-			if(editor.getChannel() == channel){
-				return editor;
-			}
-		}
-		return null;
-	}
-
 	private Session getSession(int sid) {
 		for(Session session : sessionList){
 			if(session.getSID() == sid) return session;