def run!
      EventMachine::run do
        Signal.trap("INT") {
          puts "It's a trap!"
          EventMachine.stop
        }
        Signal.trap("TERM") {
          puts "It's a trap!"
          EventMachine.stop
        }

        EventMachine.kqueue = true if EventMachine.kqueue?
        EventMachine.epoll = true if EventMachine.epoll?


        STDERR.puts "start server at #{host} #{port}"
        if @app.non_blocking?
          STDERR.puts "Not blocking on requests"
        end


        EventMachine::start_server(host, port, Gopher::Dispatcher) do |conn|
          #
          # check if we should reload any scripts before moving along
          #
          @app.reload_stale

          #
          # roughly matching sinatra's style of duping the app to respond
          # to requests, @see http://www.sinatrarb.com/intro#Request/Instance%20Scope
          #
          # this essentially means we have 'one instance per request'
          #
          conn.app = @app.dup
        end
      end
    end
def run!
      EventMachine::run do
        Signal.trap("INT") {
          puts "It's a trap!"
          EventMachine.stop
        }
        Signal.trap("TERM") {
          puts "It's a trap!"
          EventMachine.stop
        }

        EventMachine.kqueue = true if EventMachine.kqueue?
        EventMachine.epoll = true if EventMachine.epoll?


        STDERR.puts "start server at #{host} #{port}"
        if @app.non_blocking?
          STDERR.puts "Not blocking on requests"
        end


        EventMachine::start_server(host, port, Gopher::Dispatcher) do |conn|
          #
          # check if we should reload any scripts before moving along
          #
          @app.reload_stale

          #
          # roughly matching sinatra's style of duping the app to respond
          # to requests, @see http://www.sinatrarb.com/intro#Request/Instance%20Scope
          #
          # this essentially means we have 'one instance per request'
          #
          conn.app = @app.dup
        end
      end
    end
main app loop. called via at_exit block defined in DSL