Mercurial > hg > RemoteEditor > REPSessionManager
changeset 24:7012a944e58f
*** empty log message ***
author | pin |
---|---|
date | Thu, 08 Nov 2007 18:51:41 +0900 |
parents | 01657c033761 |
children | 2b4863af8804 |
files | rep/Editor.java rep/EditorList.java rep/SessionManager.java |
diffstat | 3 files changed, 24 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/Editor.java Thu Nov 08 17:19:45 2007 +0900 +++ b/rep/Editor.java Thu Nov 08 18:51:41 2007 +0900 @@ -40,5 +40,8 @@ public void setEID(int eid) { this.eid = eid; } + public String toString(){ + return ("eid:" + eid + ":" + channel.socket().getLocalSocketAddress().toString()); + } }
--- a/rep/EditorList.java Thu Nov 08 17:19:45 2007 +0900 +++ b/rep/EditorList.java Thu Nov 08 18:51:41 2007 +0900 @@ -11,15 +11,18 @@ public void sendJoinAck(REPCommand repCmd) { Editor editor = null; for(Editor editor2 : editorList){ + error(String.valueOf(editor2.getEID()), String.valueOf(repCmd.eid)); if(editor2.getEID() == repCmd.eid){ editor = editor2; + break; } } - if(editor == null){System.out.println("error");} + error(editor); REPPacketSend send = new REPPacketSend(editor.getChannel()); send.send(repCmd); } + public void sendJoinAck(SocketChannel channel, REPCommand repCmd) { REPCommand command = repCmd; command.setCMD(REP.SMCMD_JOIN_ACK); @@ -46,5 +49,18 @@ } } } + + private void error(Object obj) { + if(obj == null){ + System.out.println("null!"); + } + } + private void error(String str1, String str2){ + if(str1.equals(str2)){ + return; + }else{ + System.out.println("Not equals! str1:str2"); + } + } }
--- a/rep/SessionManager.java Thu Nov 08 17:19:45 2007 +0900 +++ b/rep/SessionManager.java Thu Nov 08 18:51:41 2007 +0900 @@ -164,7 +164,7 @@ case REP.SMCMD_SM_JOIN_ACK: this.isMaster = false; myHost = repCmd.host; - smList.add(channel); //SessionManagerのリストへ追加 + //smList.add(channel); //SessionManagerのリストへ追加 break; case REP.SMCMD_UPDATE: int sessionID2 = sessionlist.addSession(channel, repCmd.string); //Sessionを作成 @@ -255,9 +255,9 @@ } System.out.println(""); registerChannel(selector, sessionchannel, SelectionKey.OP_READ); - REPCommand sm_join_com = REPCommand.SMCMD_SESSION_JOIN; - String socketString = getSocketString(sessionchannel); - sm_join_com.setString(sm_join_com.string + ":" + socketString); + //REPCommand sm_join_com = REPCommand.SMCMD_SESSION_JOIN; + //String socketString = getSocketString(sessionchannel); + //sm_join_com.setString(sm_join_com.string + ":" + socketString); send.send(REPCommand.SMCMD_SESSION_JOIN); smList.add(sessionchannel); }catch (IOException e) {