Sha256: 7c5a1d74d9305668a84e86bb90a04d30d6948433a0fe08dbdbd62f8e944f19c7

Contents?: true

Size: 738 Bytes

Versions: 4

Compression:

Stored size: 738 Bytes

Contents

# frozen_string_literal: true

module Nonnative
  class HTTPServer < Nonnative::Server
    def initialize(service)
      log = File.open(service.log, 'a')
      options = { log_writer: Puma::LogWriter.new(log, log) }
      @server = Puma::Server.new(app, Puma::Events.new, options)

      super(service)
    end

    protected

    def perform_start
      server.add_tcp_listener proxy.host, proxy.port
      server.run.join
    end

    def perform_stop
      server.stop(true)
    end

    def wait_start
      timeout.perform do
        super until server.running
      end
    end

    def wait_stop
      timeout.perform do
        super while server.running
      end
    end

    private

    attr_reader :queue, :server
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nonnative-1.79.0 lib/nonnative/http_server.rb
nonnative-1.78.0 lib/nonnative/http_server.rb
nonnative-1.77.0 lib/nonnative/http_server.rb
nonnative-1.76.0 lib/nonnative/http_server.rb