Mercurial > hg > RemoteEditor > REPSessionManager
changeset 85:d5cd4d103eea
*** empty log message ***
author | pin |
---|---|
date | Fri, 21 Dec 2007 16:58:51 +0900 |
parents | 54334d83194a |
children | cd2b4d8fff9b |
files | rep/EditorList.java rep/SessionManager.java |
diffstat | 2 files changed, 30 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/EditorList.java Fri Dec 21 16:03:04 2007 +0900 +++ b/rep/EditorList.java Fri Dec 21 16:58:51 2007 +0900 @@ -82,4 +82,16 @@ } } + + public Editor getEditor(String hostport) { + // TODO Auto-generated method stub + for(Editor editor : editorList){ + String hostandport = editor.getHost() + ":" + editor.getPort(); + if(hostport.equals(hostandport)){ + return editor; + } + } + return null; + } + }
--- a/rep/SessionManager.java Fri Dec 21 16:03:04 2007 +0900 +++ b/rep/SessionManager.java Fri Dec 21 16:58:51 2007 +0900 @@ -192,16 +192,29 @@ sendCommand.setEID(eid2); send.send(sendCommand); }else { - + Editor master = session.getMaster(); + master.send(receivedCommand); } break; case REP.SMCMD_SELECT_ACK: - receivedCommand.setCMD(REP.SMCMD_JOIN_ACK); - receivedCommand.setEID(receivedCommand.eid); - session = sessionlist.getSession(receivedCommand.sid); - session.sendToEditor(receivedCommand); + + String hostport = receivedCommand.string; + Editor editor2 = allEditorList.getEditor(hostport); + if(editor2 != null) { + REPCommand command2 = new REPCommand(); + command2.setCMD(REP.SMCMD_JOIN_ACK); + command2.setEID(receivedCommand.eid); + editor2.send(command2); + }else{ + smList.sendExcept(channel, receivedCommand); + } + + //receivedCommand.setCMD(REP.SMCMD_JOIN_ACK); + //receivedCommand.setEID(receivedCommand.eid); + //session = sessionlist.getSession(receivedCommand.sid); + //session.sendToEditor(receivedCommand); //Editor editor3 = session3.getEditorList().get(0); //REPPacketSend send = new REPPacketSend(editor3.getChannel()); //send.send(repCmd);