Mercurial > hg > RemoteEditor > REPSessionManager
diff rep/SessionManager.java @ 179:763aad2da6b3
*** empty log message ***
author | pin |
---|---|
date | Thu, 28 Aug 2008 22:53:05 +0900 |
parents | a097b1d619a1 |
children | e5a7aad3fbc0 |
line wrap: on
line diff
--- a/rep/SessionManager.java Thu Aug 28 22:04:48 2008 +0900 +++ b/rep/SessionManager.java Thu Aug 28 22:53:05 2008 +0900 @@ -2,28 +2,17 @@ import java.io.IOException; import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.nio.ByteBuffer; -import java.nio.CharBuffer; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SocketChannel; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.Charset; -import java.nio.charset.CharsetEncoder; + import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.Set; -import java.util.StringTokenizer; import java.util.concurrent.BlockingQueue; import rep.channel.REPServerSocketChannel; import rep.channel.REPSocketChannel; -import rep.channel.SelectionKeySimulator; -import rep.channel.SelectorSimulator; import rep.handler.PacketSet; import rep.handler.REPHandler; import rep.handler.REPHandlerImpl; @@ -324,6 +313,7 @@ //SessionListへ追加し変換テーブルを生成する。 //sessionlist.update(channel, receivedSessionList3); + sessionList.add(new Session(new Editor(channel))); smList.sendExcept(channel, receivedCommand); @@ -349,10 +339,6 @@ smList.sendToSlave(receivedCommand); break; -// case REP.REPCMD_READ: -// //sessionlist.sendCmd(channel, repCmd); -// break; - case REP.SMCMD_CH_MASTER: //maxHost を設定。 if(setMaxHost(channel, receivedCommand.string)){ @@ -374,7 +360,7 @@ Editor editor = session.getEditor(channel); Editor prevEditor = session.getPrevEditor(editor); -// マージ中は前のエディタからのコマンドを受信しない + //マージ中は前のエディタからのコマンドを受信しない if(editor.isMerging()){ //Handlerを切り替える setMergeState(prevEditor.getChannel(), session.getSID()); @@ -422,8 +408,12 @@ } private boolean setMaxHost(REPSocketChannel channel, String maxHost2) { - // TODO Auto-generated method stub - return false; + if(maxHost.compareTo(maxHost2) > 0){ + return false; + }else{ + maxHost = maxHost2; + return true; + } } private void setMyHostName(String localHostName) { @@ -460,7 +450,6 @@ private void openWindow() { Thread th = new Thread( gui ); th.start(); - //System.out.println(sessionmanagerGUI.toString()); gui.addConnectionListener(this); gui.addREPActionListener(this); } @@ -557,12 +546,7 @@ } public void addWaitingCommand(PacketSet set) { - // TODO Auto-generated method stub packetSetList.add(set); } - public void undo() { - // TODO Auto-generated method stub - - } }