Mercurial > hg > RemoteEditor > Eclipse
changeset 203:fce2776071d4
package rep copy
author | one |
---|---|
date | Sat, 18 Dec 2010 13:18:54 +0900 |
parents | 2e9aacccfbf4 |
children | aaab17635d0c |
files | src/rep/REP.java src/rep/REPCommand.java src/rep/REPCommandPacker.java |
diffstat | 3 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/rep/REP.java Fri Dec 17 17:23:19 2010 +0900 +++ b/src/rep/REP.java Sat Dec 18 13:18:54 2010 +0900 @@ -9,6 +9,7 @@ REPCMD_DELETE_ACK ( 10), REPCMD_CLOSE ( 11), REPCMD_CLOSE_2 ( 12), + REPCMD_MERGE_MARK(13), REPCMD_NOP ( 15), SMCMD_JOIN ( 41), SMCMD_JOIN_ACK ( 42), @@ -34,7 +35,8 @@ MERGE_EID ( -2), SMCMD_SYNC ( 83), - SMCMD_SYNC_ACK ( 84); + SMCMD_SYNC_ACK ( 84), + SMCMD_SLEEP(85); public final int id;
--- a/src/rep/REPCommand.java Fri Dec 17 17:23:19 2010 +0900 +++ b/src/rep/REPCommand.java Sat Dec 18 13:18:54 2010 +0900 @@ -11,6 +11,8 @@ public int lineno; public String string; + // if this command is an undo command, it has it's original + public REPCommand original; public REPCommand(REP cmd,int sid,int eid, int seq, int lineno, String string) { this.cmd = cmd; @@ -19,6 +21,7 @@ this.seq = seq; this.lineno = lineno; this.string = string; + this.original = null; } public REPCommand(REPCommand cmd){ @@ -36,6 +39,7 @@ this.seq = seq; this.lineno = lineno; this.string = string; + this.original = null; } public String toString(){ @@ -65,4 +69,8 @@ seq = i; } + public boolean isSameSeq(REPCommand commit) { + return seq==commit.seq && sid==commit.sid && eid==commit.eid; + } + }
--- a/src/rep/REPCommandPacker.java Fri Dec 17 17:23:19 2010 +0900 +++ b/src/rep/REPCommandPacker.java Sat Dec 18 13:18:54 2010 +0900 @@ -91,7 +91,11 @@ int seqid = header.getInt(); int lineno = header.getInt(); int textsiz = header.getInt(); - + + /** + * We should avoid large reading here. Large command should be + * broke in smaller one. It should be easy. + */ if (textsiz>TEXTSIZELIMIT||textsiz<0) { // corrupted packet throw new IOException();