class Puma::Server

def run_lopez_mode(background=true)

def run_lopez_mode(background=true)
  @thread_pool = ThreadPool.new(@min_threads,
                                @max_threads,
                                Hash) do |client, tl|
    io = client.to_io
    addr = io.peeraddr.last
    if addr.empty?
      # Set unix socket addrs to localhost
      addr = "127.0.0.1:0"
    else
      addr = "#{addr}:#{io.peeraddr[1]}"
    end
    env = { 'thread' => tl, REMOTE_ADDR => addr }
    begin
      @app.call env, client.to_io
    rescue Object => e
      STDERR.puts "! Detected exception at toplevel: #{e.message} (#{e.class})"
      STDERR.puts e.backtrace
    end
    client.close unless env['detach']
  end
  @events.fire :state, :running
  if background
    @thread = Thread.new do
      Puma.set_thread_name "server"
      handle_servers_lopez_mode
    end
    return @thread
  else
    handle_servers_lopez_mode
  end
end