# HG changeset patch # User pin # Date 1198326720 -32400 # Node ID d32096538dc3d5da8a292f121d657e092706b500 # Parent eded5012be89173f9703eceb121b07369ed0ba2e *** empty log message *** diff -r eded5012be89 -r d32096538dc3 export/sessionmanager.jar Binary file export/sessionmanager.jar has changed diff -r eded5012be89 -r d32096538dc3 rep/SessionManager.java --- a/rep/SessionManager.java Sat Dec 22 21:22:36 2007 +0900 +++ b/rep/SessionManager.java Sat Dec 22 21:32:00 2007 +0900 @@ -499,50 +499,51 @@ } public void ActionOccured(REPActionEvent event) { - - SocketChannel editorChannel = event.getEditorChannel(); - int sid = event.getSID(); - Editor editor = new Editor(editorChannel); - editor.setHost(this.myHost); - Session session = sessionlist.getSession(sid); - session.addEditor(editor); - Editor owner = session.getMaster(); - - REPCommand command = new REPCommand(); - command.setCMD(REP.SMCMD_SELECT); - command.setSID(sid); - command.setString(editor.getHost() + ":" + editor.getPort()); - owner.send(command); + /*** 元の ***/ +// SocketChannel editorChannel = event.getEditorChannel(); +// int sid = event.getSID(); +// Editor editor = new Editor(editorChannel); +// editor.setHost(this.myHost); +// Session session = sessionlist.getSession(sid); +// session.addEditor(editor); +// +// Editor owner = session.getMaster(); +// +// REPCommand command = new REPCommand(); +// command.setCMD(REP.SMCMD_SELECT); +// command.setSID(sid); +// command.setString(editor.getHost() + ":" + editor.getPort()); +// owner.send(command); /*** 書き直し ***/ -// SocketChannel channel = event.getEditorChannel(); -// int sid = event.getSID(); -// Session session = sessionlist.getSession(sid); -// if(session.isOwner()){ -// int eid = session.addEditor(new Editor(channel)); -// REPCommand sendCommand = new REPCommand(); -// sendCommand.setCMD(REP.SMCMD_JOIN_ACK); -// sendCommand.setEID(eid); -// sendCommand.setSID(sid); -// REPPacketSend sender = new REPPacketSend(channel); -// sender.send(sendCommand); -// }else { -// SocketChannel editorChannel = event.getEditorChannel(); -// sid = event.getSID(); -// Editor editor = new Editor(editorChannel); -// editor.setHost(myHost); -// session = sessionlist.getSession(sid); -// session.addEditor(editor); -// -// Editor owner = session.getMaster(); -// -// REPCommand command = new REPCommand(); -// command.setCMD(REP.SMCMD_SELECT); -// command.setSID(sid); -// command.setString(editor.getHost() + ":" + editor.getPort()); -// owner.send(command); -// } + SocketChannel channel = event.getEditorChannel(); + int sid = event.getSID(); + Session session = sessionlist.getSession(sid); + if(session.isOwner()){ + int eid = session.addEditor(new Editor(channel)); + REPCommand sendCommand = new REPCommand(); + sendCommand.setCMD(REP.SMCMD_JOIN_ACK); + sendCommand.setEID(eid); + sendCommand.setSID(sid); + REPPacketSend sender = new REPPacketSend(channel); + sender.send(sendCommand); + }else { + SocketChannel editorChannel = event.getEditorChannel(); + sid = event.getSID(); + Editor editor = new Editor(editorChannel); + editor.setHost(myHost); + session = sessionlist.getSession(sid); + session.addEditor(editor); + + Editor owner = session.getMaster(); + + REPCommand command = new REPCommand(); + command.setCMD(REP.SMCMD_SELECT); + command.setSID(sid); + command.setString(editor.getHost() + ":" + editor.getPort()); + owner.send(command); + } //REPPacketSend send = new REPPacketSend(editorChannel);