commit 229286be544e76771d2a64637b3c692e51cbd878 (patch)
parent de313da Rainbows! 5.1.1
tree a29be86e137e4619030fb19cdcaad1b60391c386
author Eric Wong <e@80x24.org> 2018-05-18 06:27:05 +0000
committer Eric Wong <e@80x24.org> 2019-01-02 21:40:46 +0000
quiet mismatched indentation warnings
Ruby trunk started warning about more mismatched indentations
starting around r62836.
---
lib/rainbows/app_pool.rb | 4 ++--
lib/rainbows/base.rb | 4 ++--
lib/rainbows/configurator.rb | 4 ++--
lib/rainbows/coolio/client.rb | 8 ++++----
lib/rainbows/coolio/thread_client.rb | 4 ++--
lib/rainbows/epoll/client.rb | 30 ++++++++++++++--------------
lib/rainbows/epoll/response_pipe.rb | 6 +++---
lib/rainbows/error.rb | 6 +++---
lib/rainbows/ev_core.rb | 8 ++++----
lib/rainbows/fiber/body.rb | 4 ++--
lib/rainbows/fiber/io.rb | 4 ++--
lib/rainbows/http_server.rb | 8 ++++----
lib/rainbows/process_client.rb | 4 ++--
lib/rainbows/response.rb | 16 +++++++--------
lib/rainbows/revactor.rb | 4 ++--
lib/rainbows/revactor/client/methods.rb | 4 ++--
lib/rainbows/revactor/client/tee_socket.rb | 2 +-
lib/rainbows/reverse_proxy/coolio.rb | 22 ++++++++++----------
lib/rainbows/stream_response_epoll/client.rb | 6 +++---
lib/rainbows/thread_timeout.rb | 10 +++++-----
lib/rainbows/xepoll/client.rb | 4 ++--
lib/rainbows/xepoll_thread_pool/client.rb | 8 ++++----
lib/rainbows/xepoll_thread_spawn/client.rb | 8 ++++----
t/bin/unused_listen | 2 +-
t/hijack.ru | 4 ++--
t/sha1-random-size.ru | 2 +-
26 files changed, 93 insertions(+), 93 deletions(-)
diff --git a/lib/rainbows/app_pool.rb b/lib/rainbows/app_pool.rb
index 44c6bf5..2d71604 100644
--- a/lib/rainbows/app_pool.rb
+++ b/lib/rainbows/app_pool.rb
@@ -97,7 +97,7 @@ class Rainbows::AppPool < Struct.new(:pool, :re)
app = pool.shift
app.call(env)
- ensure
- pool << app
+ ensure
+ pool << app
end
end
diff --git a/lib/rainbows/base.rb b/lib/rainbows/base.rb
index a7ba17d..d0e7342 100644
--- a/lib/rainbows/base.rb
+++ b/lib/rainbows/base.rb
@@ -49,8 +49,8 @@ module Rainbows::Base
logger.info "worker=#{worker_nr} reopening logs..."
Unicorn::Util.reopen_logs
logger.info "worker=#{worker_nr} done reopening logs"
- rescue
- Rainbows.quit! # let the master reopen and refork us
+ rescue
+ Rainbows.quit! # let the master reopen and refork us
end
# :startdoc:
end
diff --git a/lib/rainbows/configurator.rb b/lib/rainbows/configurator.rb
index d82002e..83077cb 100644
--- a/lib/rainbows/configurator.rb
+++ b/lib/rainbows/configurator.rb
@@ -46,8 +46,8 @@ module Rainbows::Configurator
block_given? or raise ArgumentError, "Rainbows! requires a block"
@block = true
instance_eval(&block)
- ensure
- @block = false
+ ensure
+ @block = false
end
def check! # :nodoc:
diff --git a/lib/rainbows/coolio/client.rb b/lib/rainbows/coolio/client.rb
index cd22c22..12c1434 100644
--- a/lib/rainbows/coolio/client.rb
+++ b/lib/rainbows/coolio/client.rb
@@ -160,8 +160,8 @@ class Rainbows::Coolio::Client < Coolio::IO
on_read(''.freeze)
end
end
- rescue => e
- handle_error(e)
+ rescue => e
+ handle_error(e)
end
def handle_error(e)
@@ -170,8 +170,8 @@ class Rainbows::Coolio::Client < Coolio::IO
@_io.kgio_trywrite(msg) rescue nil
end
@_write_buffer.clear
- ensure
- quit
+ ensure
+ quit
end
def close_deferred
diff --git a/lib/rainbows/coolio/thread_client.rb b/lib/rainbows/coolio/thread_client.rb
index a3a2ebf..e977381 100644
--- a/lib/rainbows/coolio/thread_client.rb
+++ b/lib/rainbows/coolio/thread_client.rb
@@ -16,8 +16,8 @@ class Rainbows::Coolio::ThreadClient < Rainbows::Coolio::Client
def response_write(response)
return hijacked if @hp.hijacked?
ev_write_response(*response, @hp.next?)
- rescue => e
- handle_error(e)
+ rescue => e
+ handle_error(e)
end
# fails-safe application dispatch, we absolutely cannot
diff --git a/lib/rainbows/epoll/client.rb b/lib/rainbows/epoll/client.rb
index 85e504c..6ed141e 100644
--- a/lib/rainbows/epoll/client.rb
+++ b/lib/rainbows/epoll/client.rb
@@ -39,8 +39,8 @@ module Rainbows::Epoll::Client
@wr_queue = [] # may contain String, ResponsePipe, and StreamFile objects
post_init
on_readable
- rescue => e
- handle_error(e)
+ rescue => e
+ handle_error(e)
end
def on_readable
@@ -56,9 +56,9 @@ module Rainbows::Epoll::Client
break
end until :close == @state
close unless closed?
- rescue Errno::ECONNRESET
- close
- rescue IOError
+ rescue Errno::ECONNRESET
+ close
+ rescue IOError
end
def app_call input # called by on_read()
@@ -146,8 +146,8 @@ module Rainbows::Epoll::Client
def handle_error(e)
msg = Rainbows::Error.response(e) and kgio_trywrite(msg) rescue nil
- ensure
- close
+ ensure
+ close
end
def write_deferred(obj)
@@ -171,8 +171,8 @@ module Rainbows::Epoll::Client
when :deferred
return
end while true
- rescue => e
- handle_error(e)
+ rescue => e
+ handle_error(e)
end
def write(buf)
@@ -227,9 +227,9 @@ module Rainbows::Epoll::Client
else
return n # :wait_writable or nil
end while true
- rescue
- sf.close
- raise
+ rescue
+ sf.close
+ raise
end
def defer_file_stream(offset, count, io, body)
@@ -263,8 +263,8 @@ module Rainbows::Epoll::Client
else # nil => EOF
return pipe.close # nil
end while true
- rescue
- pipe.close
- raise
+ rescue
+ pipe.close
+ raise
end
end
diff --git a/lib/rainbows/epoll/response_pipe.rb b/lib/rainbows/epoll/response_pipe.rb
index 64b1547..87b2818 100644
--- a/lib/rainbows/epoll/response_pipe.rb
+++ b/lib/rainbows/epoll/response_pipe.rb
@@ -14,9 +14,9 @@ class Rainbows::Epoll::ResponsePipe
def epoll_run
return close if @client.closed?
@client.stream_pipe(self) or @client.on_deferred_write_complete
- rescue => e
- close
- @client.handle_error(e)
+ rescue => e
+ close
+ @client.handle_error(e)
end
def close
diff --git a/lib/rainbows/error.rb b/lib/rainbows/error.rb
index 3686eab..57c9173 100644
--- a/lib/rainbows/error.rb
+++ b/lib/rainbows/error.rb
@@ -8,18 +8,18 @@ module Rainbows::Error
# the socket is closed at the end of this function
def self.write(io, e)
msg = response(e) and Kgio.trywrite(io, msg)
- rescue
+ rescue
end
def self.app(e)
Unicorn.log_error(Rainbows.server.logger, "app error", e)
- rescue
+ rescue
end
def self.listen_loop(e)
Rainbows.alive or return
Unicorn.log_error(Rainbows.server.logger, "listen loop error", e)
- rescue
+ rescue
end
def self.response(e)
diff --git a/lib/rainbows/ev_core.rb b/lib/rainbows/ev_core.rb
index fd33786..0537f6f 100644
--- a/lib/rainbows/ev_core.rb
+++ b/lib/rainbows/ev_core.rb
@@ -43,8 +43,8 @@ module Rainbows::EvCore
def handle_error(e)
msg = Rainbows::Error.response(e) and write(msg)
- ensure
- quit
+ ensure
+ quit
end
# returns whether to enable response chunking for autochunk models
@@ -119,8 +119,8 @@ module Rainbows::EvCore
want_more
end
end
- rescue => e
- handle_error(e)
+ rescue => e
+ handle_error(e)
end
def err_413(msg)
diff --git a/lib/rainbows/fiber/body.rb b/lib/rainbows/fiber/body.rb
index 5b2c74b..d9e925f 100644
--- a/lib/rainbows/fiber/body.rb
+++ b/lib/rainbows/fiber/body.rb
@@ -19,8 +19,8 @@ module Rainbows::Fiber::Body # :nodoc:
else # nil
return
end while true
- ensure
- close_if_private(body)
+ ensure
+ close_if_private(body)
end
end
diff --git a/lib/rainbows/fiber/io.rb b/lib/rainbows/fiber/io.rb
index 111132f..dcd8c14 100644
--- a/lib/rainbows/fiber/io.rb
+++ b/lib/rainbows/fiber/io.rb
@@ -37,8 +37,8 @@ class Rainbows::Fiber::IO
buf = readpartial(16384)
yield buf
yield buf while readpartial(16384, buf)
- rescue EOFError
- self
+ rescue EOFError
+ self
end
def closed?
diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb
index 33bb96c..e925d80 100644
--- a/lib/rainbows/http_server.rb
+++ b/lib/rainbows/http_server.rb
@@ -71,10 +71,10 @@ class Rainbows::HttpServer < Unicorn::HttpServer
@logger.warn "#{svc} may monopolize resources dictated by #{resource}" \
" and leave none for your app"
end
- rescue => e
- @logger.error e.message
- @logger.error "#{resource} needs to be increased to >=#{want} before" \
- " starting #{svc}"
+ rescue => e
+ @logger.error e.message
+ @logger.error "#{resource} needs to be increased to >=#{want} before" \
+ " starting #{svc}"
end
def svc
diff --git a/lib/rainbows/process_client.rb b/lib/rainbows/process_client.rb
index 4bf9878..b500b75 100644
--- a/lib/rainbows/process_client.rb
+++ b/lib/rainbows/process_client.rb
@@ -83,8 +83,8 @@ module Rainbows::ProcessClient
write_response(status, headers, body, alive = hp.next?) or return
end while alive && pipeline_ready(hp)
alive or close
- rescue => e
- handle_error(e)
+ rescue => e
+ handle_error(e)
end
# override this in subclass/module
diff --git a/lib/rainbows/response.rb b/lib/rainbows/response.rb
index 62dfa39..a76821f 100644
--- a/lib/rainbows/response.rb
+++ b/lib/rainbows/response.rb
@@ -91,8 +91,8 @@ module Rainbows::Response
body = write_headers(status, headers, alive, body)
write_body_each(body) if body
body
- ensure
- body.close if body.respond_to?(:close)
+ ensure
+ body.close if body.respond_to?(:close)
end
end
include Each
@@ -102,8 +102,8 @@ module Rainbows::Response
def write_body_file(body, range)
io = body_to_io(body)
range ? sendfile(io, range[0], range[1]) : sendfile(io, 0)
- ensure
- close_if_private(io)
+ ensure
+ close_if_private(io)
end
end
include Sendfile
@@ -129,8 +129,8 @@ module Rainbows::Response
# isn't used or available.
def write_body_stream(body)
COPY_STREAM.copy_stream(io = body_to_io(body), self)
- ensure
- close_if_private(io)
+ ensure
+ close_if_private(io)
end
else # ! COPY_STREAM
alias write_body_stream write_body_each
@@ -199,8 +199,8 @@ module Rainbows::Response
write_body_stream(body) if body
end
body
- ensure
- body.close if body.respond_to?(:close)
+ ensure
+ body.close if body.respond_to?(:close)
end
module ToPath
diff --git a/lib/rainbows/revactor.rb b/lib/rainbows/revactor.rb
index fae5f16..69a791c 100644
--- a/lib/rainbows/revactor.rb
+++ b/lib/rainbows/revactor.rb
@@ -75,8 +75,8 @@ module Rainbows::Revactor
end
Actor.sleep 1 while Rainbows.tick || nr > 0
- rescue Errno::EMFILE
- # ignore, let another worker process take it
+ rescue Errno::EMFILE
+ # ignore, let another worker process take it
end
def revactorize_listeners #:nodoc:
diff --git a/lib/rainbows/revactor/client/methods.rb b/lib/rainbows/revactor/client/methods.rb
index 592c996..defb23a 100644
--- a/lib/rainbows/revactor/client/methods.rb
+++ b/lib/rainbows/revactor/client/methods.rb
@@ -26,8 +26,8 @@ module Rainbows::Revactor::Client::Methods
else # nil
return
end while true
- ensure
- close_if_private(body)
+ ensure
+ close_if_private(body)
end
end
diff --git a/lib/rainbows/revactor/client/tee_socket.rb b/lib/rainbows/revactor/client/tee_socket.rb
index 2f9f52e..31b8dec 100644
--- a/lib/rainbows/revactor/client/tee_socket.rb
+++ b/lib/rainbows/revactor/client/tee_socket.rb
@@ -34,7 +34,7 @@ class Rainbows::Revactor::Client::TeeSocket
# ugh, read returned too much
@rbuf << tmp[length, tmp.size]
dst.replace(tmp[0, length])
- rescue EOFError
+ rescue EOFError
end
# just proxy any remaining methods TeeInput may use
diff --git a/lib/rainbows/reverse_proxy/coolio.rb b/lib/rainbows/reverse_proxy/coolio.rb
index 86f2b79..e3b33b5 100644
--- a/lib/rainbows/reverse_proxy/coolio.rb
+++ b/lib/rainbows/reverse_proxy/coolio.rb
@@ -36,17 +36,17 @@ module Rainbows::ReverseProxy::Coolio
return close
end while true # we always read until EAGAIN or EOF
- rescue => e
- case e
- when Errno::ECONNRESET
- @env['async.callback'].call(@response)
- return close
- when SystemCallError
- else
- Unicorn.log_error(@env["rack.logger"], "on_readable", e)
- end
- @env['async.callback'].call(Rainbows::ReverseProxy::E502)
- close
+ rescue => e
+ case e
+ when Errno::ECONNRESET
+ @env['async.callback'].call(@response)
+ return close
+ when SystemCallError
+ else
+ Unicorn.log_error(@env["rack.logger"], "on_readable", e)
+ end
+ @env['async.callback'].call(Rainbows::ReverseProxy::E502)
+ close
end
end
diff --git a/lib/rainbows/stream_response_epoll/client.rb b/lib/rainbows/stream_response_epoll/client.rb
index dc226d6..b757469 100644
--- a/lib/rainbows/stream_response_epoll/client.rb
+++ b/lib/rainbows/stream_response_epoll/client.rb
@@ -47,9 +47,9 @@ class Rainbows::StreamResponseEpoll::Client
when :wait_writable
return @wr_queue.unshift(buf)
end while true
- rescue => err
- @to_io.close
- N.decr(0, 1)
+ rescue
+ @to_io.close
+ N.decr(0, 1)
end
def on_write_complete
diff --git a/lib/rainbows/thread_timeout.rb b/lib/rainbows/thread_timeout.rb
index 8739d29..bea1631 100644
--- a/lib/rainbows/thread_timeout.rb
+++ b/lib/rainbows/thread_timeout.rb
@@ -134,11 +134,11 @@ class Rainbows::ThreadTimeout
@lock.synchronize { @active.delete(Thread.current) }
# Thread#raise no longer possible here
end
- rescue ExecutionExpired
- # If we got here, it's because the watchdog thread raised an exception
- # here to kill us. The watchdog uses @active.delete_if with a lock,
- # so we guaranteed it's
- [ 408, { 'Content-Type' => 'text/plain', 'Content-Length' => '0' }, [] ]
+ rescue ExecutionExpired
+ # If we got here, it's because the watchdog thread raised an exception
+ # here to kill us. The watchdog uses @active.delete_if with a lock,
+ # so we guaranteed it's
+ [ 408, { 'Content-Type' => 'text/plain', 'Content-Length' => '0' }, [] ]
end
# The watchdog thread is the one that does the job of killing threads
diff --git a/lib/rainbows/xepoll/client.rb b/lib/rainbows/xepoll/client.rb
index f518db5..748b4af 100644
--- a/lib/rainbows/xepoll/client.rb
+++ b/lib/rainbows/xepoll/client.rb
@@ -40,8 +40,8 @@ module Rainbows::XEpoll::Client
@wr_queue = [] # may contain String, ResponsePipe, and StreamFile objects
post_init
EP.set(self, IN) # wake up the main thread
- rescue => e
- Rainbows::Error.write(self, e)
+ rescue => e
+ Rainbows::Error.write(self, e)
end
def on_close
diff --git a/lib/rainbows/xepoll_thread_pool/client.rb b/lib/rainbows/xepoll_thread_pool/client.rb
index ca62727..810d992 100644
--- a/lib/rainbows/xepoll_thread_pool/client.rb
+++ b/lib/rainbows/xepoll_thread_pool/client.rb
@@ -95,8 +95,8 @@ module Rainbows::XEpollThreadPool::Client
def handle_error(e)
super
- ensure
- closed? or close
+ ensure
+ closed? or close
end
def queue!
@@ -114,8 +114,8 @@ module Rainbows::XEpollThreadPool::Client
else
return close
end while true
- rescue => e
- handle_error(e)
+ rescue => e
+ handle_error(e)
end
def run
diff --git a/lib/rainbows/xepoll_thread_spawn/client.rb b/lib/rainbows/xepoll_thread_spawn/client.rb
index 218db3e..8eebbb0 100644
--- a/lib/rainbows/xepoll_thread_spawn/client.rb
+++ b/lib/rainbows/xepoll_thread_spawn/client.rb
@@ -84,8 +84,8 @@ module Rainbows::XEpollThreadSpawn::Client
def handle_error(e)
super
- ensure
- closed? or close
+ ensure
+ closed? or close
end
def epoll_run(buf)
@@ -98,8 +98,8 @@ module Rainbows::XEpollThreadSpawn::Client
else
return close
end while true
- rescue => e
- handle_error(e)
+ rescue => e
+ handle_error(e)
end
def spawn(env, hp)
diff --git a/t/bin/unused_listen b/t/bin/unused_listen
index b638f54..8cce645 100755
--- a/t/bin/unused_listen
+++ b/t/bin/unused_listen
@@ -31,7 +31,7 @@ begin
# when running tests in parallel with gmake. Create a lock file while
# we have the port here to ensure that does not happen.
lock_path = "#{Dir::tmpdir}/unicorn_test.#{addr}:#{port}.lock"
- lock = File.open(lock_path, File::WRONLY|File::CREAT|File::EXCL, 0600)
+ File.open(lock_path, File::WRONLY|File::CREAT|File::EXCL, 0600)
rescue Errno::EEXIST
sock.close rescue nil
retry
diff --git a/t/hijack.ru b/t/hijack.ru
index 64c23d7..16b5f38 100644
--- a/t/hijack.ru
+++ b/t/hijack.ru
@@ -45,9 +45,9 @@ run lambda { |env|
[ 200,
{
"Content-Length" => r.bytesize.to_s,
- "rack.hijack" => proc do |io|
+ "rack.hijack" => proc do |sock|
io.write(r)
- lazy_close(io)
+ lazy_close(sock)
end
},
DieIfUsed.new
diff --git a/t/sha1-random-size.ru b/t/sha1-random-size.ru
index 4ef5d7b..9251221 100644
--- a/t/sha1-random-size.ru
+++ b/t/sha1-random-size.ru
@@ -18,7 +18,7 @@ app = lambda do |env|
end while input.read(rand(cap), buf)
end
when "/each"
- input.each { |buf| digest.update(buf) }
+ input.each { |chunk| digest.update(chunk) }
else
if buf = input.read(rand(cap))
begin
glossary
--------
Commit objects reference one tree, and zero or more parents.
Single parent commits can typically generate a patch in
unified diff format via `git format-patch'.
Multiple parents means the commit is a merge.
Root commits have no ancestor. Note that it is
possible to have multiple root commits when merging independent histories.
Every commit references one top-level tree object.
git clone http://yhbt.net/rainbows.git