diff rep/SessionManager.java @ 155:bbd2801d8ce0

*** empty log message ***
author pin
date Thu, 28 Aug 2008 15:39:20 +0900
parents 2ce1a378da85
children 5cc8cd48bded
line wrap: on
line diff
--- a/rep/SessionManager.java	Thu Aug 28 15:33:02 2008 +0900
+++ b/rep/SessionManager.java	Thu Aug 28 15:39:20 2008 +0900
@@ -56,6 +56,7 @@
 	private List<Editor> editorList;
 	private String maxHost;
 	private boolean isSimulation;
+	private List<PacketSet> packetSetList;
 	//private Set<SelectionKey> sessionList;
 	private static int temp_port;
 	private static int send_port;
@@ -70,14 +71,11 @@
 		selector = REPSelector.open();
 	}
 	
-	public void mainLoop(int port) throws InterruptedException, IOException {
+	public void init(int port) throws InterruptedException, IOException {
 	
 		REPServerSocketChannel<REPCommand> ssc = REPServerSocketChannel.<REPCommand>open();
-		
 		ssc.configureBlocking(false);	//reuse address 必須
-		
 		ssc.socket().setReuseAddress(true);
-		
 		ssc.socket().bind(new InetSocketAddress(port));
 		ssc.register(selector, SelectionKey.OP_ACCEPT);
 
@@ -87,7 +85,13 @@
 		smList = new SessionManagerList();
 		ownEditorList = new EditorList();
 		editorList = new LinkedList<Editor>();
+		packetSetList = new LinkedList<PacketSet>();
 		
+		// main loop
+		mainLoop();
+	}
+
+	private void mainLoop() throws IOException {
 		while(true){
 			selector.select();
 			select();
@@ -398,7 +402,8 @@
 		SessionManager sm = new SessionManager(port);
 		sm.openSelector();
 		sm.openWindow();
-		sm.mainLoop(port);
+		sm.init(port);
+		sm.mainLoop();
 	}
 
 	private void openWindow() {
@@ -498,7 +503,7 @@
 
 	public void addWaitingCommand(PacketSet set) {
 		// TODO Auto-generated method stub
-		
+		packetSetList.add(set);
 	}
 
 	public void undo() {