# HG changeset patch # User one # Date 1284357131 -32400 # Node ID 97593c486db63053b42dfbfddf291950564a67b1 # Parent bd086be276d2a385764d8b47316d04cdd2f262a7 blocking in-editor packet/out-editor packet in merging diff -r bd086be276d2 -r 97593c486db6 rep/handler/Editor.java --- a/rep/handler/Editor.java Mon Sep 13 00:49:34 2010 +0900 +++ b/rep/handler/Editor.java Mon Sep 13 14:52:11 2010 +0900 @@ -82,7 +82,7 @@ switch(command.cmd) { case REPCMD_INSERT_ACK: case REPCMD_DELETE_ACK: - // if (waitingRequired(command)) return; + if (waitingRequired(command,null)) return; if (command.eid==eid) { // Second Phase が終わって同期が終了。 checkAck(command); @@ -112,13 +112,13 @@ return; } else if (command.eid == eid){ // 編集コマンドが一周して来た - // if (waitingRequired(command)) return; + if (waitingRequired(command,null)) return; checkReturnedCommand(command); return; } //他のエディタからの編集コマンド - // if (waitingRequired(command)) return; + if (waitingRequired(command,null)) return; translator.transReceiveCmd(next,command); sendEditorCommand(command); @@ -158,13 +158,13 @@ // assert(count==0); // } - private boolean waitingRequired(REPCommand command) { + private boolean waitingRequired(REPCommand command, REPSocketChannel channel) { if (hasWaitingCommand()) { // We cannot do this operation before watingCommandQueue. addWaitingCommand(new PacketSet(channel, this, new REPCommand(command))); return true; } else if (isMerging()) { - addWaitingCommand(new PacketSet(getChannel(), this, new REPCommand(command))); + addWaitingCommand(new PacketSet(channel, this, new REPCommand(command))); return true; } //ServerMainLoop.logger.writeLog("Editor eid:"+eid+" no waiting"); @@ -401,7 +401,7 @@ public void send(REPCommand command) { if (command.eid == REP.MERGE_EID.id || command.cmd==REP.SMCMD_END_MERGE || - !waitingRequired(command)) { + !waitingRequired(command,channel)) { super.send(command); } } @@ -466,8 +466,10 @@ } PacketSet p = w.remove(0); try { - send(p.command); - // manage(p.command); + if (p.channel!=null) + send(p.command); + else + manage(p.command); } catch (Exception e1) { assert false; manager.close(p.channel);