Mercurial > hg > RemoteEditor > REPSessionManager
diff rep/handler/Forwarder.java @ 386:bba62c4ac323
sync-option
author | one@firefly.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Mon, 10 Nov 2008 22:19:34 +0900 |
parents | 1fca50ce3508 |
children | 6f356d160e58 |
line wrap: on
line diff
--- a/rep/handler/Forwarder.java Mon Nov 10 22:18:14 2008 +0900 +++ b/rep/handler/Forwarder.java Mon Nov 10 22:19:34 2008 +0900 @@ -5,6 +5,7 @@ import rep.PacketSet; import rep.REP; import rep.REPCommand; +import rep.Session; import rep.SessionManager; import rep.channel.REPLogger; import rep.channel.REPSelectionKey; @@ -93,5 +94,35 @@ return false; } + public void selectSession(REPCommand sendCommand,Session session) { + if(session.hasOwner()){ + // we have a selected session. + if (isDirect()&&getEID()==sendCommand.eid) { + // Found directly connected joined editor. Send join_ack(). + // we have one more point to send JOIN_ACK to the editor. + session.addForwarder(this); + manager.sendUpdate(session.getSID()); + sendCommand.setCMD(REP.SMCMD_JOIN_ACK); + if (manager.sync) { + REPCommand sync = new REPCommand(sendCommand); + sync.setCMD(REP.SMCMD_SYNC); + sendSync(sync); + } + } else { + // We have a session, but joined editor is on the other sm. + // SELECT_ACK is sent to the session ring to + // find out the joined editor. + sendCommand.setCMD(REP.SMCMD_SELECT_ACK); + } + sendCommand.string = session.getName(); + send(sendCommand); + }else { + manager.forwardSelect(sid, session, eid, this); + } + } + + + + } \ No newline at end of file