public void accept_event ()
    {
        SocketChannel fd = null ;
        
        try {
            fd = accept ();
            Utils.tune_tcp_socket (fd);
            Utils.tune_tcp_keepalives (fd, options.tcp_keepalive, options.tcp_keepalive_cnt, options.tcp_keepalive_idle, options.tcp_keepalive_intvl);
        } catch (IOException e) {
            //  If connection was reset by the peer in the meantime, just ignore it.
            //  TODO: Handle specific errors like ENFILE/EMFILE etc.
            ZError.exc (e);
            socket.event_accept_failed (endpoint, ZError.errno());
            return;
        }

        
        //  Create the engine object for this connection.
        StreamEngine engine = null;
        try {
            engine = new StreamEngine (fd, options, endpoint);
        } catch (ZError.InstantiationException e) {
            ZError.errno (ZError.EINVAL);
            socket.event_accept_failed (endpoint, ZError.errno());
            return;
        }
        //  Choose I/O thread to run connecter in. Given that we are already
        //  running in an I/O thread, there must be at least one available.
        IOThread io_thread = choose_io_thread (options.affinity);

        //  Create and launch a session object. 
        SessionBase session = SessionBase.create (io_thread, false, socket,
            options, new Address(fd.socket().getRemoteSocketAddress()));
        session.inc_seqnum ();
        launch_child (session);
        send_attach (session, engine, false);
        socket.event_accepted (endpoint, fd);
    }