diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-05-04 01:34:01 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-05-04 03:49:55 +0000 |
commit | a7830cce6a3bf13996fe42503164437fb9809909 (patch) | |
tree | 9dcc662f83d4816de0e32fb12595685067dfb3ee /lib/unicorn.rb | |
parent | 9af6edf6af212c1fcaccb1999b66dfd89ccfb693 (diff) | |
download | unicorn-a7830cce6a3bf13996fe42503164437fb9809909.tar.gz |
If our response succeeds, we've already closed the socket. Otherwise, we would've raised an exception at some point hit one of the rescue clauses.
Diffstat (limited to 'lib/unicorn.rb')
-rw-r--r-- | lib/unicorn.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb index 593b43b..db25223 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -420,19 +420,16 @@ module Unicorn # the socket is closed at the end of this function rescue EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF client.write_nonblock(Const::ERROR_500_RESPONSE) rescue nil + client.close rescue nil rescue HttpParserError # try to tell the client they're bad client.write_nonblock(Const::ERROR_400_RESPONSE) rescue nil + client.close rescue nil rescue Object => e client.write_nonblock(Const::ERROR_500_RESPONSE) rescue nil + client.close rescue nil logger.error "Read error: #{e.inspect}" logger.error e.backtrace.join("\n") ensure - begin - client.closed? or client.close - rescue Object => e - logger.error "Client error: #{e.inspect}" - logger.error e.backtrace.join("\n") - end @request.reset end |