rainbows 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/GIT-VERSION-GEN CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v4.0.0.GIT
4
+ DEF_VER=v4.1.0.GIT
5
5
 
6
6
  LF='
7
7
  '
data/bin/rainbows CHANGED
@@ -8,7 +8,7 @@ ENV["RACK_ENV"] ||= "development"
8
8
  rackup_opts = Unicorn::Configurator::RACKUP
9
9
  options = rackup_opts[:options]
10
10
 
11
- opts = OptionParser.new("", 24, ' ') do |opts|
11
+ op = OptionParser.new("", 24, ' ') do |opts|
12
12
  cmd = File.basename($0)
13
13
  opts.banner = "Usage: #{cmd} " \
14
14
  "[ruby options] [#{cmd} options] [rackup config file]"
@@ -106,7 +106,8 @@ opts = OptionParser.new("", 24, ' ') do |opts|
106
106
  opts.parse! ARGV
107
107
  end
108
108
 
109
- app = Unicorn.builder(ARGV[0] || 'config.ru', opts)
109
+ app = Unicorn.builder(ARGV[0] || 'config.ru', op)
110
+ op = nil
110
111
 
111
112
  if $DEBUG
112
113
  require 'pp'
data/lib/rainbows.rb CHANGED
@@ -1,20 +1,8 @@
1
1
  # -*- encoding: binary -*-
2
2
  require 'kgio'
3
3
  require 'unicorn'
4
- require 'io/wait'
5
- Unicorn::SocketHelper::DEFAULTS.merge!({
6
- # the value passed to TCP_DEFER_ACCEPT actually matters in Linux 2.6.32+
7
- :tcp_defer_accept => 60,
8
-
9
- # keep-alive performance sucks without this due to
10
- # write(headers)-write(body)-read
11
- # because we always write headers and bodies with two calls
12
- :tcp_nodelay => true,
13
-
14
- # we always want to send our headers out ASAP since Rainbows!
15
- # is designed for apps that could trickle out the body slowly
16
- :tcp_nopush => false,
17
- })
4
+ # the value passed to TCP_DEFER_ACCEPT actually matters in Linux 2.6.32+
5
+ Unicorn::SocketHelper::DEFAULTS[:tcp_defer_accept] = 60
18
6
 
19
7
  # See http://rainbows.rubyforge.org/ for documentation
20
8
  module Rainbows
@@ -1,34 +1,9 @@
1
1
  # -*- encoding: binary -*-
2
2
  # :enddoc:
3
- require "io/wait"
4
3
 
5
4
  # this class is used for most synchronous concurrency models
6
5
  class Rainbows::Client < Kgio::Socket
7
6
  include Rainbows::ProcessClient
8
- Rainbows.config!(self, :keepalive_timeout)
9
-
10
- def read_expire
11
- Time.now + KEEPALIVE_TIMEOUT
12
- end
13
-
14
- def kgio_wait_readable
15
- wait KEEPALIVE_TIMEOUT
16
- end
17
-
18
- # used for reading headers (respecting keepalive_timeout)
19
- def timed_read(buf)
20
- expire = nil
21
- begin
22
- case rv = kgio_tryread(CLIENT_HEADER_BUFFER_SIZE, buf)
23
- when :wait_readable
24
- return if expire && expire < Time.now
25
- expire ||= read_expire
26
- kgio_wait_readable
27
- else
28
- return rv
29
- end
30
- end while true
31
- end
32
7
 
33
8
  alias write kgio_write
34
9
  end
@@ -2,7 +2,7 @@
2
2
  # :enddoc:
3
3
  module Rainbows::Const
4
4
 
5
- RAINBOWS_VERSION = '4.0.0'
5
+ RAINBOWS_VERSION = '4.1.0'
6
6
 
7
7
  include Unicorn::Const
8
8
 
@@ -28,7 +28,7 @@ module Rainbows::Fiber::Coolio::Methods
28
28
  @w.disable
29
29
  end
30
30
 
31
- def kgio_wait_readable
31
+ def kgio_wait_readable(timeout = nil)
32
32
  @r = Watcher.new(self, :r) unless defined?(@r)
33
33
  @r.enable unless @r.enabled?
34
34
  Fiber.yield
@@ -29,7 +29,7 @@ module Rainbows::Fiber::IO::Methods
29
29
  super
30
30
  end
31
31
 
32
- def kgio_wait_readable
32
+ def kgio_wait_readable(timeout = nil)
33
33
  fd = fileno
34
34
  @f = Fiber.current
35
35
  RD[fd] = self
@@ -7,7 +7,26 @@ module Rainbows::ProcessClient
7
7
  NULL_IO = Unicorn::HttpRequest::NULL_IO
8
8
  RACK_INPUT = Unicorn::HttpRequest::RACK_INPUT
9
9
  IC = Unicorn::HttpRequest.input_class
10
- Rainbows.config!(self, :client_header_buffer_size)
10
+ Rainbows.config!(self, :client_header_buffer_size, :keepalive_timeout)
11
+
12
+ def read_expire
13
+ Time.now + KEEPALIVE_TIMEOUT
14
+ end
15
+
16
+ # used for reading headers (respecting keepalive_timeout)
17
+ def timed_read(buf)
18
+ expire = nil
19
+ begin
20
+ case rv = kgio_tryread(CLIENT_HEADER_BUFFER_SIZE, buf)
21
+ when :wait_readable
22
+ return if expire && expire < Time.now
23
+ expire ||= read_expire
24
+ kgio_wait_readable(KEEPALIVE_TIMEOUT)
25
+ else
26
+ return rv
27
+ end
28
+ end while true
29
+ end
11
30
 
12
31
  def process_loop
13
32
  @hp = hp = Rainbows::HttpParser.new
@@ -18,6 +18,14 @@ module Rainbows::SocketProxy
18
18
  to_io.kgio_trywrite(buf)
19
19
  end
20
20
 
21
+ def kgio_tryread(size, buf = "")
22
+ to_io.kgio_tryread(size, buf)
23
+ end
24
+
25
+ def kgio_wait_readable(timeout = nil)
26
+ to_io.kgio_wait_readable(timeout)
27
+ end
28
+
21
29
  def timed_read(buf)
22
30
  to_io.timed_read(buf)
23
31
  end
data/rainbows.gemspec CHANGED
@@ -24,8 +24,8 @@ Gem::Specification.new do |s|
24
24
  # we want a newer Rack for a valid HeaderHash#each
25
25
  s.add_dependency(%q<rack>, ['~> 1.1'])
26
26
 
27
- # kgio has some fixes for MRI 1.9.3dev that affect us
28
- s.add_dependency(%q<kgio>, ['~> 2.4'])
27
+ # kgio 2.5 has kgio_wait_* methods that take optional timeout args
28
+ s.add_dependency(%q<kgio>, ['~> 2.5'])
29
29
 
30
30
  # we need Unicorn for the HTTP parser and process management
31
31
  s.add_dependency(%q<unicorn>, ["~> 4.0"])
data/t/t0044-autopush.sh CHANGED
@@ -49,8 +49,8 @@ check_TCP_CORK () {
49
49
  done
50
50
 
51
51
  test 2 -eq $(grep TCP_CORK $strace_out | wc -l)
52
- fgrep 'SOL_TCP, TCP_CORK, [0], 4) = 0' $strace_out
53
- fgrep 'SOL_TCP, TCP_CORK, [1], 4) = 0' $strace_out
52
+ fgrep 'SOL_TCP, TCP_CORK, [0],' $strace_out
53
+ fgrep 'SOL_TCP, TCP_CORK, [1],' $strace_out
54
54
  }
55
55
 
56
56
  t_begin "setup and start" && {
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rainbows
3
3
  version: !ruby/object:Gem::Version
4
- hash: 63
4
+ hash: 59
5
5
  prerelease:
6
6
  segments:
7
7
  - 4
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 4.0.0
10
+ version: 4.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rainbows! hackers
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-27 00:00:00 Z
18
+ date: 2011-07-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rack
@@ -40,11 +40,11 @@ dependencies:
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- hash: 11
43
+ hash: 9
44
44
  segments:
45
45
  - 2
46
- - 4
47
- version: "2.4"
46
+ - 5
47
+ version: "2.5"
48
48
  type: :runtime
49
49
  version_requirements: *id002
50
50
  - !ruby/object:Gem::Dependency