Mercurial > hg > RemoteEditor > REPSessionManager
changeset 405:0b1d52ffb803
TestEditor fix
author | one |
---|---|
date | Tue, 25 Nov 2008 03:46:31 +0900 |
parents | 4bb04d5a9bbf |
children | 8009dd7b2013 |
files | Todo test/sematest/TestEditor.java |
diffstat | 2 files changed, 73 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/Todo Tue Nov 25 03:29:47 2008 +0900 +++ b/Todo Tue Nov 25 03:46:31 2008 +0900 @@ -9,6 +9,9 @@ INSERT_USER/DELETE_USERを入れて回避。Editor側の変更も必要になるが、 まぁ、仕方がない。 +Editor側で、自分が出したINSERT/DELETE commandは無視する必要がある。 +ついでに、Editor側でINSERT_ACK/DELETE_ACKに書き換える方が良いらしい。 + Wed Nov 19 19:21:47 JST 2008 ACK base に書き換えるのは良いが、途中でjoinして
--- a/test/sematest/TestEditor.java Tue Nov 25 03:29:47 2008 +0900 +++ b/test/sematest/TestEditor.java Tue Nov 25 03:46:31 2008 +0900 @@ -229,79 +229,83 @@ ns.writeLog(name +"(eid="+eid+",sid="+sid+")"+": read "+cmd); switch(cmd.cmd) { case REPCMD_INSERT : - text.insert(cmd.lineno, cmd.string); + if (cmd.eid!=eid) { + text.insert(cmd.lineno, cmd.string); + } forwardCommand(cmd); break; case REPCMD_DELETE : - String del=""; - if(cmd.lineno>text.size()) { - del = text.delete(cmd.lineno); + if (cmd.eid!=eid) { + String del=""; + if(cmd.lineno>text.size()) { + del = text.delete(cmd.lineno); + } + cmd.setString(del); } - cmd.setString(del); forwardCommand(cmd); break; - case REPCMD_NOP : - case REPCMD_INSERT_ACK : - case REPCMD_DELETE_ACK : - forwardCommand(cmd); - break; - case REPCMD_CLOSE : - case REPCMD_CLOSE_2 : - assert(false); - break; + case REPCMD_NOP : + case REPCMD_INSERT_ACK : + case REPCMD_DELETE_ACK : + forwardCommand(cmd); + break; + case REPCMD_CLOSE : + case REPCMD_CLOSE_2 : + assert(false); + break; - case SMCMD_JOIN_ACK : - sid = cmd.sid; - eid = cmd.eid; - name += "(eid="+eid+",sid="+sid+")"; - inputLock = false; - break; - case SMCMD_PUT_ACK : - sid = cmd.sid; - eid = cmd.eid; - name += "(eid="+eid+",sid="+sid+")"; - inputLock = false; - break; - case SMCMD_QUIT : - if (cmd.eid!=eid) - forwardCommand(cmd); - else - sendCommand(new REPCommand(REP.SMCMD_QUIT_2, - sid, eid, seq, 0, "")); - // stop input processing after this command - cmds.clear(); - break; - case SMCMD_START_MERGE : - // lock user input during merge (optional) - inputLock = hasInputLock; - cmd.cmd = REP.SMCMD_START_MERGE_ACK; - sendCommand(cmd); - break; - case SMCMD_END_MERGE : - inputLock = false; - break; - case SMCMD_QUIT_2 : - if (cmd.eid!=eid) { - forwardCommand(cmd); - } else { - cmd.cmd = REP.SMCMD_QUIT_2_ACK; - sendCommand(cmd); - } - running = false; - break; - case SMCMD_SYNC: - // start contents sync with newly joined editor - cmd.cmd = REP.SMCMD_SYNC_ACK; - forwardCommand(cmd); - //if (cmd.eid==eid) { - if (master && syncEnable ) { - syncCounter = 1; - timeout = 1; - } - break; - default: - assert(false); - break; + case SMCMD_JOIN_ACK : + sid = cmd.sid; + eid = cmd.eid; + name += "(eid="+eid+",sid="+sid+")"; + inputLock = false; + break; + case SMCMD_PUT_ACK : + sid = cmd.sid; + eid = cmd.eid; + name += "(eid="+eid+",sid="+sid+")"; + inputLock = false; + break; + case SMCMD_QUIT : + if (cmd.eid!=eid) + forwardCommand(cmd); + else + sendCommand(new REPCommand(REP.SMCMD_QUIT_2, + sid, eid, seq, 0, "")); + // stop input processing after this command + cmds.clear(); + break; + case SMCMD_START_MERGE : + // lock user input during merge (optional) + inputLock = hasInputLock; + cmd.cmd = REP.SMCMD_START_MERGE_ACK; + sendCommand(cmd); + break; + case SMCMD_END_MERGE : + inputLock = false; + break; + case SMCMD_QUIT_2 : + if (cmd.eid!=eid) { + forwardCommand(cmd); + } else { + cmd.cmd = REP.SMCMD_QUIT_2_ACK; + sendCommand(cmd); + } + running = false; + break; + case SMCMD_SYNC: + // start contents sync with newly joined editor + cmd.cmd = REP.SMCMD_SYNC_ACK; + forwardCommand(cmd); + //if (cmd.eid==eid) { + if (master && syncEnable ) { + syncCounter = 1; + timeout = 1; + } + break; + default: + assert(false); + break; } }