changeset 104:91f053bdfb18

*** empty log message ***
author pin
date Sat, 22 Dec 2007 21:00:44 +0900
parents caea2e66deb8
children 9c97532b9851
files rep/SessionManager.java
diffstat 1 files changed, 41 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/rep/SessionManager.java	Sat Dec 22 19:26:25 2007 +0900
+++ b/rep/SessionManager.java	Sat Dec 22 21:00:44 2007 +0900
@@ -503,49 +503,49 @@
 
 	public void ActionOccured(REPActionEvent event) {
 
-//		SocketChannel editorChannel = event.getEditorChannel();
-//		int sid = event.getSID();
-//		Editor editor = new Editor(editorChannel);
-//		editor.setHost(this.myHost);
-//		Session session = sessionlist.getSession(sid);
-//		session.addEditor(editor);
-//		
-//		Editor owner = session.getMaster();
-//		
-//		REPCommand command = new REPCommand();
-//		command.setCMD(REP.SMCMD_SELECT);
-//		command.setSID(sid);
-//		command.setString(editor.getHost() + ":" + editor.getPort());
-//		owner.send(command);
+		SocketChannel editorChannel = event.getEditorChannel();
+		int sid = event.getSID();
+		Editor editor = new Editor(editorChannel);
+		editor.setHost(this.myHost);
+		Session session = sessionlist.getSession(sid);
+		session.addEditor(editor);
+		
+		Editor owner = session.getMaster();
+		
+		REPCommand command = new REPCommand();
+		command.setCMD(REP.SMCMD_SELECT);
+		command.setSID(sid);
+		command.setString(editor.getHost() + ":" + editor.getPort());
+		owner.send(command);
 		
 		/***  ***/
-		SocketChannel channel = event.getEditorChannel();
-		int sid = event.getSID();
-		Session session = sessionlist.getSession(sid);
-		if(session.isOwner()){
-			int eid = session.addEditor(new Editor(channel));
-			REPCommand sendCommand = new REPCommand();
-			sendCommand.setCMD(REP.SMCMD_JOIN_ACK);
-			sendCommand.setEID(eid);
-			sendCommand.setSID(sid);
-			REPPacketSend sender = new REPPacketSend(channel);
-			sender.send(sendCommand);
-		}else {
-			SocketChannel editorChannel = event.getEditorChannel();
-			sid = event.getSID();
-			Editor editor = new Editor(editorChannel);
-			editor.setHost(this.myHost);
-			session = sessionlist.getSession(sid);
-			session.addEditor(editor);
-			
-			Editor owner = session.getMaster();
-			
-			REPCommand command = new REPCommand();
-			command.setCMD(REP.SMCMD_SELECT);
-			command.setSID(sid);
-			command.setString(editor.getHost() + ":" + editor.getPort());
-			owner.send(command);
-		}
+//		SocketChannel channel = event.getEditorChannel();
+//		int sid = event.getSID();
+//		Session session = sessionlist.getSession(sid);
+//		if(session.isOwner()){
+//			int eid = session.addEditor(new Editor(channel));
+//			REPCommand sendCommand = new REPCommand();
+//			sendCommand.setCMD(REP.SMCMD_JOIN_ACK);
+//			sendCommand.setEID(eid);
+//			sendCommand.setSID(sid);
+//			REPPacketSend sender = new REPPacketSend(channel);
+//			sender.send(sendCommand);
+//		}else {
+//			SocketChannel editorChannel = event.getEditorChannel();
+//			sid = event.getSID();
+//			Editor editor = new Editor(editorChannel);
+//			editor.setHost(myHost);
+//			session = sessionlist.getSession(sid);
+//			session.addEditor(editor);
+//			
+//			Editor owner = session.getMaster();
+//			
+//			REPCommand command = new REPCommand();
+//			command.setCMD(REP.SMCMD_SELECT);
+//			command.setSID(sid);
+//			command.setString(editor.getHost() + ":" + editor.getPort());
+//			owner.send(command);
+//		}
 		
 		
 		//REPPacketSend send = new REPPacketSend(editorChannel);