# HG changeset patch # User pin # Date 1219909992 -32400 # Node ID 6a5974dd0368f4a00037322691ab0e336a4f1e5b # Parent ecab03b50e084c32d38305f97d560954638c0f2d *** empty log message *** diff -r ecab03b50e08 -r 6a5974dd0368 rep/SessionManager.java --- a/rep/SessionManager.java Thu Aug 28 16:38:35 2008 +0900 +++ b/rep/SessionManager.java Thu Aug 28 16:53:12 2008 +0900 @@ -45,18 +45,19 @@ public class SessionManager implements ConnectionListener, REPActionListener{ - private SessionList sessionlist; + //private SessionList sessionlist; private List sessionList; private SessionManagerGUI gui; private Selector selector; private SessionManagerList smList; private String myHost; private boolean isMaster = true; - private EditorList ownEditorList; + //private EditorList ownEditorList; private List editorList; private String maxHost; private boolean isSimulation; private List packetSetList; + private List managerList; private static int temp_port; private static int send_port; @@ -217,28 +218,32 @@ break; case REP.SMCMD_SELECT_ACK: - + { String hostport = receivedCommand.string; - Editor editor2 = ownEditorList.getEditor(hostport); - if(editor2 != null) { - REPCommand command2 = new REPCommand(); - command2.setCMD(REP.SMCMD_JOIN_ACK); - command2.setSID(receivedCommand.sid); - command2.setEID(receivedCommand.eid); - editor2.send(command2); + Editor editor = getEditor(hostport); + + if(editor != null) { + //host, port を見て、このコマンドが自分が送信したSelectコマンドのAckかどうかを判断する + REPCommand command = new REPCommand(); + command.setCMD(REP.SMCMD_JOIN_ACK); + command.setSID(receivedCommand.sid); + command.setEID(receivedCommand.eid); + editor.send(command); + }else{ + //自分が送信したコマンドでなければ、次のSessionManagerへ中継する smList.sendExcept(channel, receivedCommand); } + } break; case REP.SMCMD_SM_JOIN: - - if(isSimulation){ - smList.add(channel); - break; - } - + { + managerList.add(channel); + } + + { //SessionManagerのリストへ追加 smList.add(channel); @@ -274,10 +279,7 @@ sendCommand.setString(receivedCommand.string); smList.sendExcept(channel, sendCommand); - if(isMaster){ - }else { - } - + } break; case REP.SMCMD_SM_JOIN_ACK: @@ -354,6 +356,10 @@ } } + private Editor getEditor(String hostport) { + return null; + } + private Editor getEditor(REPSocketChannel channel) { // TODO Auto-generated method stub for(Editor editor : editorList){