yahns Ruby server user/dev discussion
 help / color / Atom feed
aa2867f2d0b8cc8f5237fc06bf06b9b6abd12d31 blob 1598 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 
# Copyright (C) 2013-2016 all contributors <yahns-public@yhbt.net>
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
# frozen_string_literal: true
require_relative 'server_helper'
require 'rack/lobster'

class TestMtAccept < Testcase
  ENV["N"].to_i > 1 and parallelize_me!
  include ServerHelper
  alias setup server_helper_setup
  alias teardown server_helper_teardown

  def test_mt_accept
    skip "Linux kernel required" unless RUBY_PLATFORM =~ /linux/
    skip "/proc not mounted" unless File.directory?("/proc")
    err, cfg, host, port = @err, Yahns::Config.new, @srv.addr[3], @srv.addr[1]
    opts = { threads: 1 }
    cfg.instance_eval do
      GTL.synchronize do
        app(:rack, Rack::Lobster.new) { listen "#{host}:#{port}", threads: 1 }
      end
      stderr_path err.path
    end
    pid = mkserver(cfg)
    Net::HTTP.start(host, port) do |http|
      assert_equal 200, http.request(Net::HTTP::Get.new("/")).code.to_i
    end
    orig_count = Dir["/proc/#{pid}/task/*"].size
    quit_wait(pid)

    cfg = Yahns::Config.new
    opts = { threads: 1 }
    cfg.instance_eval do
      GTL.synchronize do
        app(:rack, Rack::Lobster.new) { listen "#{host}:#{port}", threads: 2 }
      end
      stderr_path err.path
    end
    pid = mkserver(cfg)
    Net::HTTP.start(host, port) do |http|
      assert_equal 200, http.request(Net::HTTP::Get.new("/")).code.to_i
    end
    Timeout.timeout(30) do
      begin
        new_count = Dir["/proc/#{pid}/task/*"].size
      end until new_count == (orig_count + 1) && sleep(0.01)
    end
  ensure
    quit_wait(pid)
  end
end
debug log:

solving aa2867f ...
found aa2867f in https://yhbt.net/yahns.git

yahns Ruby server user/dev discussion

Archives are clonable:
	git clone --mirror https://yhbt.net/yahns-public
	git clone --mirror http://ou63pmih66umazou.onion/yahns-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.yahns
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.yahns

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git