Configure channel blocking as part of adding to the event-loop.
[jagi.git] / src / jagi / scgi / EventServer.java
index 1a6bc2a..2de2e86 100644 (file)
@@ -21,11 +21,6 @@ public class EventServer implements Runnable {
                                                                    tgt -> new Thread(tgt, "Request handler thread"));
 
     public EventServer(ServerSocketChannel sk, Function handler) {
-       try {
-           sk.configureBlocking(false);
-       } catch(IOException e) {
-           throw(new RuntimeException(e));
-       }
        this.sk = sk;
        this.handler = handler;
     }
@@ -431,11 +426,8 @@ public class EventServer implements Runnable {
        public int events() {return(SelectionKey.OP_ACCEPT);}
 
        public void handle(int events) throws IOException {
-           if((events & SelectionKey.OP_ACCEPT) != 0) {
-               SocketChannel cl = sk.accept();
-               cl.configureBlocking(false);
-               Driver.current().add(new Client(cl));
-           }
+           if((events & SelectionKey.OP_ACCEPT) != 0)
+               Driver.current().add(new Client(sk.accept()));
        }
 
        public void close() {