# HG changeset patch # User one # Date 1287714477 -32400 # Node ID 4aba8ae3125b59942801f7efe13c7751bdea8964 # Parent c49a86a7ab8f66dc1d0df3df4caedda0160cdcd5 debugging new merge diff -r c49a86a7ab8f -r 4aba8ae3125b rep/handler/Editor.java --- a/rep/handler/Editor.java Thu Oct 21 23:03:22 2010 +0900 +++ b/rep/handler/Editor.java Fri Oct 22 11:27:57 2010 +0900 @@ -196,13 +196,14 @@ private void userEditorCommand(REPCommand command) { //エディタからの新たな編集コマンド - if (mergeMode==MergeMode.Direct) { - truncateSentList(command); - ServerMainLoop.logger.writeLog("Editor"+eid+": User Command "+command+report()); - } if (next==this) return; // singleton case transSendCmd(command); sendEditorCommand(command); + if (mergeMode==MergeMode.Direct) { + ServerMainLoop.logger.writeLog("Editor"+eid+": User Command Before "+command+report()); + truncateSentList(command); + ServerMainLoop.logger.writeLog("Editor"+eid+": User Command After "+command+report()); + } return; } @@ -394,6 +395,7 @@ if (last!=null && last.eid==eid && last.sid==sid) truncateSentList(last); preMergeCommand = null; + ServerMainLoop.logger.writeLog("Editor"+eid+": EndMerge "+report()); return ; } sortedEditCmds = null; @@ -460,6 +462,10 @@ if (flag) sentList = s; } + /** + * Send ack command after receiving self command + * @param command + */ private void sendAck(REPCommand command) { REPCommand keep = new REPCommand(command); // First Phase End, send ACK @@ -627,7 +633,7 @@ */ public REPCommand transSendCmd(REPCommand cmd){ assert(cmd.eid==eid); - unMergedCmds.addLast(cmd); + unMergedCmds.addFirst(cmd); //マージ中にユーザから割り込みがあった場合 if(isMerging()){ @@ -651,7 +657,8 @@ // merge queue上にあるコマンドを全部undoコマンドするのと同時に // sort したコマンド列を生成する for( REPCommand cmd0 : unMergedCmds) { - output.addLast( createUndo(cmd0) ); + if (cmd0.cmd==REP.REPCMD_INSERT || cmd0.cmd==REP.REPCMD_DELETE) + output.addLast( createUndo(cmd0) ); } sortedEditCmds = new TreeSet(new REPCommandComparator(1)); @@ -830,7 +837,7 @@ */ public void mergeAck() { logger.writeLog("Editor"+eid+": START MERGE "+ - ((unMergedCmds.size()>0)?" and top of unMergedCmds = "+ unMergedCmds.getLast():"")); + ((unMergedCmds.size()>0)?" unMergedCmds = "+ unMergedCmds : "")); merging = true; }