lib/puma/server.rb
def run
      BasicSocket.do_not_reverse_lookup = true

      @status = :run

      @thread_pool = ThreadPool.new(@min_threads, @max_threads) do |client|
        process_client(client)
      end

      if @auto_trim_time
        @thread_pool.auto_trim!(@auto_trim_time)
      end

      @thread = Thread.new do
        begin
          check = @check
          sockets = @ios
          pool = @thread_pool

          while @status == :run
            begin
              ios = IO.select sockets
              ios.first.each do |sock|
                if sock == check
                  break if handle_check
                else
                  pool << sock.accept
                end
              end
            rescue Errno::ECONNABORTED
              # client closed the socket even before accept
              client.close rescue nil
            rescue Object => e
              @events.unknown_error self, e, "Listen loop"
            end
          end

          graceful_shutdown if @status == :stop
        ensure
          @ios.each { |i| i.close }
        end
      end

      return @thread
    end
# Runs the server.  It returns the thread used so you can join it.
# The thread is always available via #thread to be join'd
#
Runs the server.  It returns the thread used so you can join it.
The thread is always available via #thread to be join'd
Runs the server . It returns the thread used so you can join it . The thread is always available via #thread to be join ' d
def run
      BasicSocket.do_not_reverse_lookup = true
      @status = :run
      @thread_pool = ThreadPool.new(@min_threads, @max_threads) do |client|
        process_client(client)
      end
      if @auto_trim_time
        @thread_pool.auto_trim!(@auto_trim_time)
      end
      @thread = Thread.new do
        begin
          check = @check
          sockets = @ios
          pool = @thread_pool
          while @status == :run
            begin
              ios = IO.select sockets
              ios.first.each do |sock|
                if sock == check
                  break if handle_check
                else
                  pool << sock.accept
                end
              end
            rescue Errno::ECONNABORTED
              client.close rescue nil
            rescue Object => e
              @events.unknown_error self, e, "Listen loop"
            end
          end
          graceful_shutdown if @status == :stop
        ensure
          @ios.each { |i| i.close }
        end
      end
      return @thread
    end
def run BasicSocket . do_not_reverse_lookup = true @status = :run @thread_pool = ThreadPool . new ( @min_threads , @max_threads ) do | client | process_client ( client ) end if @auto_trim_time @thread_pool . auto_trim! ( @auto_trim_time ) end @thread = Thread . new do begin check = @check sockets = @ios pool = @thread_pool while @status == :run begin ios = IO . select sockets ios . first . each do | sock | if sock == check break if handle_check else pool << sock . accept end end rescue Errno :: ECONNABORTED client . close rescue nil rescue Object => e @events . unknown_error self , e , "Listen loop" end end graceful_shutdown if @status == :stop ensure @ios . each { | i | i . close } end end return @thread end
Runs the server.
Runs the server .
# client closed the socket even before accept