Sha256: 4cf4058afc3d8b0bad655088e89a7070917c65ac5aacf61a5c8ed02aa3e03c73

Contents?: true

Size: 546 Bytes

Versions: 8

Compression:

Stored size: 546 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
}

child_pids = []
8.times do
  pid = Polyphony.fork do
    puts "forked pid: #{Process.pid}"
    Tipi.serve('0.0.0.0', 1234, opts) do |req|
      req.respond("Hello world! from pid: #{Process.pid}\n")
    end
  rescue Interrupt
  end
  child_pids << pid
end

puts 'Listening on port 1234'

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tipi-0.38 examples/http_server_forked.rb
tipi-0.37.2 examples/http_server_forked.rb
tipi-0.37.1 examples/http_server_forked.rb
tipi-0.37 examples/http_server_forked.rb
tipi-0.36 examples/http_server_forked.rb
tipi-0.35 examples/http_server_forked.rb
tipi-0.34 examples/http_server_forked.rb
tipi-0.33 examples/http_server_forked.rb