Sha256: a3c8a39218e7b93f42efd84a9eee534b1810f5d0b6f62eb5fa0601933f85f348

Contents?: true

Size: 595 Bytes

Versions: 14

Compression:

Stored size: 595 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'tipi'

::Exception.__disable_sanitized_backtrace__ = true

opts = {
  reuse_addr:  true,
  reuse_port: true,
  dont_linger: true
}

server = Tipi.listen('0.0.0.0', 1234, opts)

child_pids = []
8.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

puts 'Listening on port 1234'

trap('SIGINT') { exit! }

child_pids.each { |pid| Thread.current.backend.waitpid(pid) }

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
tipi-0.55 examples/http_server_forked.rb
tipi-0.54 examples/http_server_forked.rb
tipi-0.53 examples/http_server_forked.rb
tipi-0.52 examples/http_server_forked.rb
tipi-0.51 examples/http_server_forked.rb
tipi-0.50 examples/http_server_forked.rb
tipi-0.49 examples/http_server_forked.rb
tipi-0.47 examples/http_server_forked.rb
tipi-0.46 examples/http_server_forked.rb
tipi-0.45 examples/http_server_forked.rb
tipi-0.43 examples/http_server_forked.rb
tipi-0.42 examples/http_server_forked.rb
tipi-0.41 examples/http_server_forked.rb
tipi-0.40 examples/http_server_forked.rb