Sha256: 50dec5515a6242c9255a5ab66f921c78cfbd4fed83d862050b6b3269215b8514

Contents?: true

Size: 662 Bytes

Versions: 1

Compression:

Stored size: 662 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony/http'
require 'localhost/authority'

app_path = ARGV.first || File.expand_path('./config.ru', __dir__)
app = Polyphony::HTTP::Rack.load(app_path)

authority = Localhost::Authority.fetch
opts = {
  reuse_addr: true,
  dont_linger: true,
  secure_context: authority.server_context
}
server = Polyphony::HTTP::Server.listen('0.0.0.0', 1234, opts)
puts "Listening on port 1234"

child_pids = []
4.times do
  child_pids << Polyphony.fork do
    puts "forked pid: #{Process.pid}"
    Polyphony::HTTP::Server.each(server, opts, &app)
  end
end

child_pids.each { |pid| EV::Child.new(pid).await }

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polyphony-0.19 examples/http/rack_server_https_forked.rb