# HG changeset patch # User pin # Date 1220003556 -32400 # Node ID dbf59f82273ecdccb77eecf5c2a076580a05175b # Parent 63701e2a2fe8204669388191f9e5b093ae635ea1 *** empty log message *** diff -r 63701e2a2fe8 -r dbf59f82273e rep/SessionManager.java --- a/rep/SessionManager.java Fri Aug 29 18:51:37 2008 +0900 +++ b/rep/SessionManager.java Fri Aug 29 18:52:36 2008 +0900 @@ -40,7 +40,7 @@ //private SessionList sessionlist; private LinkedList sessionList; private SessionManagerGUI gui; - private Selector selector; + private REPSelector selector; private SessionManagerList smList; private String myHost; private boolean isMaster = true; @@ -57,11 +57,11 @@ static final int DEFAULT_PORT = 8766; public SessionManager(int port) { - gui = new SessionManagerGUI(this); + } public void openSelector() throws IOException{ - selector = REPSelector.open(); + selector = REPSelector.create(); } public void init(int port) throws InterruptedException, IOException { @@ -70,7 +70,8 @@ ssc.configureBlocking(false); //reuse address 必須 ssc.socket().setReuseAddress(true); ssc.socket().bind(new InetSocketAddress(port)); - ssc.register(selector, SelectionKey.OP_ACCEPT); + //ssc.register(selector, SelectionKey.OP_ACCEPT); + registerChannel(selector, ssc, SelectionKey.OP_ACCEPT); //sessionlist = new SessionList(); @@ -81,7 +82,7 @@ packetSetList = new LinkedList(); // main loop - mainLoop(); + //mainLoop(); } private void mainLoop() throws IOException { @@ -432,6 +433,9 @@ } public static void main(String[] args) throws InterruptedException, IOException { + + REPServerSocketChannel.isSimulation = true; + int port = DEFAULT_PORT; int port_s = DEFAULT_PORT; //System.setProperty("file.encoding", "UTF-8"); @@ -443,16 +447,16 @@ send_port = port_s; SessionManager sm = new SessionManager(port); sm.openSelector(); - sm.openWindow(); sm.init(port); + sm.startGUI(sm); sm.mainLoop(); + } - private void openWindow() { + private void startGUI(SessionManager sm) { + gui = new SessionManagerGUI(this); Thread th = new Thread( gui ); th.start(); - gui.addConnectionListener(this); - gui.addREPActionListener(this); } public void connectSession(String host) {