changeset 362:f0bd158dace6

*** empty log message ***
author kono
date Sun, 19 Oct 2008 23:05:59 +0900
parents 65c6d12a5835
children 1a8856580d38
files Todo rep/REP.java rep/Session.java rep/SessionManager.java test/Text.java
diffstat 5 files changed, 10 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/Todo	Sun Oct 19 22:50:20 2008 +0900
+++ b/Todo	Sun Oct 19 23:05:59 2008 +0900
@@ -9,6 +9,7 @@
 
 put_ack は、putの時にすぐに出してしまって構わない。select_ack
 が廻るので、その時にput_ackを出しても良いが...
+    Done: Sun Oct 19 23:10:52 JST 2008
 
 Todo: (kono)
 複数のsessionのテストを作成する
@@ -97,6 +98,7 @@
 Todo: (kono)
 Select用に、routing tableが必要らしい。session ringへの
 方向を表すtableを、put, update, update_ack時に作成する。
+    Done: Sun Oct 19 21:29:08 JST 2008
 
 Mon Oct 13 12:34:39 JST 2008
 
--- a/rep/REP.java	Sun Oct 19 22:50:20 2008 +0900
+++ b/rep/REP.java	Sun Oct 19 23:05:59 2008 +0900
@@ -1,43 +1,25 @@
 package rep;
 
 public enum REP {
-	 REPCMD_OPEN		( 1),
-	 REPCMD_OPEN_ACK	( 2),
-	 REPCMD_READ		( 3),
-	 REPCMD_READ_ACK	( 4),
 	 REPCMD_INSERT	( 6),
 	 REPCMD_INSERT_ACK	( 7),
 	 REPCMD_DELETE	( 9),
 	 REPCMD_DELETE_ACK	( 10),
 	 REPCMD_CLOSE	( 11),
 	 REPCMD_CLOSE_2	( 12),
-	 REPCMD_REPLACE	( 13),
-	 REPCMD_REPLACE_ACK	( 14),
 	 REPCMD_NOP		( 15),
 	 SMCMD_JOIN		( 41),
 	 SMCMD_JOIN_ACK	( 42),
-	 SMCMD_GET		( 43),
-	 SMCMD_GET_ACK	( 44),
 	 SMCMD_PUT		( 45),
 	 SMCMD_PUT_ACK	( 46),
 	 SMCMD_SELECT	( 47),
 	 SMCMD_SELECT_ACK	( 48),
-	 SMCMD_REGISTER	( 49),
-	 SMCMD_REGISTER_ACK	( 50),
-	 SMCMD_DEREGISTER	( 51),
-	 SMCMD_DEREGISTER_ACK( 52),
 	 SMCMD_QUIT		( 53),
 	 SMCMD_QUIT_ACK	( 54),
-	 SMCMD_SESSION   ( 60),
-	 SMCMD_SESSION_ACK    ( 61),
 	 SMCMD_SM_JOIN   ( 62),
 	 SMCMD_SM_JOIN_ACK ( 63),
 	 SMCMD_UPDATE ( 65),
 	 SMCMD_UPDATE_ACK ( 66),
-	 SMCMD_GET_UNDO ( 71),
-	 SMCMD_GET_UNDO_ACK ( 72),
-
-	 SMCMD_UNDO_REPLACE ( 73),
 	 SMCMD_START_MERGE ( 75),
 	 SMCMD_START_MERGE_ACK ( 76),
 	 SMCMD_END_MERGE ( 77),
@@ -47,9 +29,6 @@
 
 	 SM_EID ( -1),
 	 MERGE_EID ( -2),
-	 SMCMD_CH_MASTER ( 80),
-	 SMCMD_UPDATE_UP ( 81),
-	 SMCMD_UPDATE_DOWN ( 82),
 
 	 SMCMD_SYNC ( 83),
 	 SMCMD_SYNC_ACK ( 84);
--- a/rep/Session.java	Sun Oct 19 22:50:20 2008 +0900
+++ b/rep/Session.java	Sun Oct 19 23:05:59 2008 +0900
@@ -41,6 +41,7 @@
 	
 	public void addForwarder(Forwarder forwarder) {
 		// add a forwarder and connect this to the session 
+		forwarder.setSID(sessionID);
 		forwarder.setNext(last.getNextForwarder());
 		last.setNext(forwarder);
 		last = forwarder;
@@ -52,6 +53,7 @@
 	public void addEditor(Editor editor) {
 		// add a not-connected editor in a sassion
 		// the editor is outside of this manager 
+		editor.setSID(sessionID);
 		put(editor.eid,editor);
 	}
 	
@@ -175,6 +177,7 @@
 
 
 	public void setFirstForwarder(Forwarder f) {
+		f.setSID(sessionID);
 		put(f.eid,f);
 		firstForwarder = last = f;
 	}
--- a/rep/SessionManager.java	Sun Oct 19 22:50:20 2008 +0900
+++ b/rep/SessionManager.java	Sun Oct 19 23:05:59 2008 +0900
@@ -455,7 +455,10 @@
 
 	public void remove(Editor editor) {
 		Session s = sessionList.get(editor.getSID());
-		if (editor.isMaster()) {
+		if (s==null) {
+			assert(false);
+			editorList.remove(editor);
+		} else if (editor.isMaster()) {
 			removeSession(s);
 		} else {
 			s.deleteForwarder(editor);
--- a/test/Text.java	Sun Oct 19 22:50:20 2008 +0900
+++ b/test/Text.java	Sun Oct 19 23:05:59 2008 +0900
@@ -39,7 +39,7 @@
 	}
 	public String edit(REPCommand cmd){
 		if (cmd.cmd==REP.REPCMD_INSERT)        return insert(cmd.lineno, cmd.string);
-		else if (cmd.cmd==REP.REPCMD_REPLACE)  return replace(cmd.lineno, cmd.string);
+		//else if (cmd.cmd==REP.REPCMD_REPLACE)  return replace(cmd.lineno, cmd.string);
 		else if (cmd.cmd==REP.REPCMD_DELETE)   return delete(cmd.lineno);
 		//else assert false;
 		return null;