Sha256: 9fc4f47c5924eaad90bab659a259a06ab6e0db98aea075cae76ed7ca98f9b3a7

Contents?: true

Size: 569 Bytes

Versions: 6

Compression:

Stored size: 569 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony/http'

::Exception.__disable_sanitized_backtrace__ = true

opts = {
  reuse_addr:  true,
  dont_linger: true
}

server = Polyphony::HTTP::Server.listen('0.0.0.0', 1234, opts)

puts 'Listening on port 1234'

child_pids = []
4.times do
  pid = Polyphony.fork do
    puts "forked pid: #{Process.pid}"
    server.each do |req|
      req.respond("Hello world! from pid: #{Process.pid}\n")
    end
  rescue Interrupt
  end
  child_pids << pid
end

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
polyphony-http-0.27 examples/http_server_forked.rb
polyphony-http-0.26 examples/http_server_forked.rb
polyphony-http-0.25 examples/http_server_forked.rb
polyphony-http-0.24 examples/http_server_forked.rb
polyphony-0.23 examples/http/http_server_forked.rb
polyphony-0.22 examples/http/http_server_forked.rb