Sha256: 45e27267f5e2150e23deed1250fe3ba8d28d3ac46c9a67bae92b18396ac2263f

Contents?: true

Size: 643 Bytes

Versions: 25

Compression:

Stored size: 643 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'tipi'
require 'localhost/authority'

::Exception.__disable_sanitized_backtrace__ = true

authority = Localhost::Authority.fetch
opts = {
  reuse_addr:     true,
  dont_linger:    true,
  secure_context: authority.server_context
}

server = Tipi.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!\n")
    end
  rescue Interrupt
  end
  child_pids << pid
end

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

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
tipi-0.55 examples/https_server_forked.rb
tipi-0.54 examples/https_server_forked.rb
tipi-0.53 examples/https_server_forked.rb
tipi-0.52 examples/https_server_forked.rb
tipi-0.51 examples/https_server_forked.rb
tipi-0.50 examples/https_server_forked.rb
tipi-0.49 examples/https_server_forked.rb
tipi-0.47 examples/https_server_forked.rb
tipi-0.46 examples/https_server_forked.rb
tipi-0.45 examples/https_server_forked.rb
tipi-0.43 examples/https_server_forked.rb
tipi-0.42 examples/https_server_forked.rb
tipi-0.41 examples/https_server_forked.rb
tipi-0.40 examples/https_server_forked.rb
tipi-0.39 examples/https_server_forked.rb
tipi-0.38 examples/https_server_forked.rb
tipi-0.37.2 examples/https_server_forked.rb
tipi-0.37.1 examples/https_server_forked.rb
tipi-0.37 examples/https_server_forked.rb
tipi-0.36 examples/https_server_forked.rb