rainbows 4.3.1 → 4.4.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.3.1.GIT
4
+ DEF_VER=v4.4.0.GIT
5
5
 
6
6
  LF='
7
7
  '
@@ -3,7 +3,7 @@
3
3
  # This module adds \Rainbows! to the
4
4
  # {Unicorn::Configurator}[http://unicorn.bogomips.org/Unicorn/Configurator.html]
5
5
  # \Rainbows!-specific configuration options must be inside a the Rainbows!
6
- # block, otherwise Unicorn::Configurator directives may be used anwwhere
6
+ # block, otherwise Unicorn::Configurator directives may be used anywhere
7
7
  # in the file.
8
8
  #
9
9
  # Rainbows! do
@@ -2,7 +2,7 @@
2
2
  # :enddoc:
3
3
  module Rainbows::Const
4
4
 
5
- RAINBOWS_VERSION = '4.3.1'
5
+ RAINBOWS_VERSION = '4.4.0'
6
6
 
7
7
  include Unicorn::Const
8
8
 
@@ -69,7 +69,12 @@ class Rainbows::Coolio::Client < Coolio::IO
69
69
  end
70
70
 
71
71
  def timeout?
72
- nil == @deferred && @_write_buffer.empty? and close.nil?
72
+ if nil == @deferred && @_write_buffer.empty?
73
+ @_io.shutdown
74
+ true
75
+ else
76
+ false
77
+ end
73
78
  end
74
79
 
75
80
  # used for streaming sockets and pipes
@@ -16,7 +16,7 @@ require 'sendfile'
16
16
  # When serving static files, this is extremely unfair and optimized
17
17
  # for throughput at the expense of fairness. This is not an issue
18
18
  # if you're not serving static files, or if your working set is
19
- # small enough to aways be in your kernel page cache. This concurrency
19
+ # small enough to always be in your kernel page cache. This concurrency
20
20
  # model may starve clients if you have slow disks and large static files.
21
21
  #
22
22
  # === RubyGem Requirements
@@ -181,7 +181,7 @@ module Rainbows::Epoll::Client
181
181
  end
182
182
 
183
183
  def timeout!
184
- close
184
+ shutdown
185
185
  true
186
186
  end
187
187
 
@@ -30,7 +30,7 @@ module Rainbows::FiberPool
30
30
 
31
31
  begin
32
32
  schedule do |l|
33
- fib = pool.shift or break # let another worker process take it
33
+ fib = pool.pop or break # let another worker process take it
34
34
  if io = l.kgio_tryaccept
35
35
  fib.resume(io)
36
36
  else
@@ -18,7 +18,8 @@ class Rainbows::HttpServer < Unicorn::HttpServer
18
18
  @logger = Unicorn::Configurator::DEFAULTS[:logger]
19
19
  super(app, options)
20
20
  defined?(@use) or self.use = Rainbows::Base
21
- @worker_connections ||= @use == :Base ? 1 : 50
21
+ @worker_connections ||= 50
22
+ @worker_connections = 1 if @use == :Base
22
23
  end
23
24
 
24
25
  # Add one second to the timeout since our fchmod heartbeat is less
@@ -67,9 +67,31 @@ module Rainbows::StreamResponseEpoll
67
67
  end while true
68
68
  end
69
69
  end
70
- ep_client.close if ep_client
71
70
  ensure
72
71
  body.respond_to?(:close) and body.close
72
+ if ep_client
73
+ ep_client.close
74
+ else
75
+ socket.shutdown
76
+ socket.close
77
+ end
78
+ end
79
+
80
+ # once a client is accepted, it is processed in its entirety here
81
+ # in 3 easy steps: read request, call app, write app response
82
+ def process_client(client)
83
+ status, headers, body = @app.call(env = @request.read(client))
84
+
85
+ if 100 == status.to_i
86
+ client.write(Unicorn::Const::EXPECT_100_RESPONSE)
87
+ env.delete(Unicorn::Const::HTTP_EXPECT)
88
+ status, headers, body = @app.call(env)
89
+ end
90
+ @request.headers? or headers = nil
91
+ http_response_write(client, status, headers, body)
92
+ rescue => e
93
+ handle_error(client, e)
73
94
  end
95
+
74
96
  # :startdoc:
75
97
  end
@@ -19,7 +19,7 @@ class Rainbows::StreamResponseEpoll::Client
19
19
 
20
20
  def initialize(io, unwritten)
21
21
  @closed = false
22
- @to_io = io.dup
22
+ @to_io = io
23
23
  @wr_queue = [ unwritten.dup ]
24
24
  EP.set(self, OUT)
25
25
  end
@@ -50,6 +50,7 @@ class Rainbows::StreamResponseEpoll::Client
50
50
 
51
51
  def on_write_complete
52
52
  if @closed
53
+ @to_io.shutdown
53
54
  @to_io.close
54
55
  N.decr(0, 1)
55
56
  end
@@ -44,6 +44,15 @@ require 'thread'
44
44
  # does not expose a monotonic clock for users, so don't change
45
45
  # the system time while this is running. All servers should be
46
46
  # running ntpd anyways.
47
+ #
48
+ # "ensure" clauses may not fire properly or be interrupted during
49
+ # execution, so do not mix this module with code which relies on "ensure".
50
+ # (This is also true for the "Timeout" module in the Ruby standard library)
51
+ #
52
+ # "recursive locking" ThreadError exceptions may occur if
53
+ # ThreadTimeout fires while a Mutex is locked (because "ensure"
54
+ # clauses may not fire properly).
55
+
47
56
  class Rainbows::ThreadTimeout
48
57
 
49
58
  # :stopdoc:
@@ -77,7 +77,7 @@ module Rainbows::XEpollThreadPool::Client
77
77
  LOCK.synchronize do
78
78
  KATO.delete_if { |client, time| time < ot and defer << client }
79
79
  end
80
- defer.each { |io| io.closed? or io.close }
80
+ defer.each { |io| io.closed? or io.shutdown }
81
81
  end
82
82
  @@last_expire = now
83
83
  end
@@ -33,7 +33,7 @@ module Rainbows::XEpollThreadSpawn::Client
33
33
  Rainbows.at_quit do
34
34
  clients = nil
35
35
  LOCK.synchronize { clients = KATO.keys; KATO.clear }
36
- clients.each { |io| io.closed? or io.close }
36
+ clients.each { |io| io.closed? or io.shutdown }
37
37
  end
38
38
  @@last_expire = Time.now
39
39
 
@@ -25,7 +25,7 @@ t_begin "setup and start" && {
25
25
  }
26
26
 
27
27
  t_begin "wait for server to say hello to us" && {
28
- ok=$((curl --no-buffer -sS http://$listen/ || :) | \
28
+ ok=$( (curl --no-buffer -sS http://$listen/ || :) | \
29
29
  (tr -d '\0\0377' || :) | \
30
30
  awk '/Hello from the Server/ { print "ok"; exit 0 }')
31
31
 
data/t/test_isolate.rb CHANGED
@@ -16,29 +16,29 @@ $stdout.reopen($stderr)
16
16
  lock = File.open(__FILE__, "rb")
17
17
  lock.flock(File::LOCK_EX)
18
18
  Isolate.now!(opts) do
19
- gem 'kgio', '2.6.0'
19
+ gem 'kgio', '2.7.4'
20
20
  gem 'kcar', '0.3.0'
21
- gem 'raindrops', '0.7.0'
22
- gem 'unicorn', '4.1.0'
21
+ gem 'raindrops', '0.10.0'
22
+ gem 'unicorn', '4.3.1'
23
23
 
24
24
  if engine == "ruby"
25
25
  gem 'sendfile', '1.1.0'
26
26
  gem 'cool.io', '1.1.0'
27
27
 
28
28
  gem 'eventmachine', '0.12.10'
29
- gem 'sinatra', '1.2.0'
30
- gem 'async_sinatra', '0.5.0'
29
+ gem 'sinatra', '1.3.2'
30
+ gem 'async_sinatra', '1.0.0'
31
31
 
32
32
  gem 'neverblock', '0.1.6.2'
33
33
  end
34
34
 
35
35
  if defined?(::Fiber) && engine == "ruby"
36
36
  gem 'revactor', '0.1.5'
37
- gem 'rack-fiber_pool', '0.9.1'
37
+ gem 'rack-fiber_pool', '0.9.2'
38
38
  end
39
39
 
40
40
  if RUBY_PLATFORM =~ /linux/
41
- gem 'sleepy_penguin', '3.0.1'
41
+ gem 'sleepy_penguin', '3.1.0'
42
42
 
43
43
  # is 2.6.32 new enough?
44
44
  gem 'io_splice', '4.1.1' if `uname -r`.strip > '2.6.32'
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: 49
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 4
8
- - 3
9
- - 1
10
- version: 4.3.1
8
+ - 4
9
+ - 0
10
+ version: 4.4.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-09-02 00:00:00 Z
18
+ date: 2012-08-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rack
@@ -465,7 +465,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
465
465
  requirements: []
466
466
 
467
467
  rubyforge_project: rainbows
468
- rubygems_version: 1.8.5
468
+ rubygems_version: 1.8.24
469
469
  signing_key:
470
470
  specification_version: 3
471
471
  summary: "- Unicorn for sleepy apps and slow clients"