1 # -*- encoding: binary -*-
5 # if we get any error, try to write something back to the client
6 # assuming we haven't closed the socket, but don't get hung up
7 # if the socket is already closed or broken. We'll always ensure
8 # the socket is closed at the end of this function
10 msg = response(e) and Kgio.trywrite(io, msg)
15 Rainbows.server.logger.error "app error: #{e.inspect}"
16 Rainbows.server.logger.error e.backtrace.join("\n")
20 def self.listen_loop(e)
21 Rainbows.alive or return
22 Rainbows.server.logger.error "listen loop error: #{e.inspect}."
23 Rainbows.server.logger.error e.backtrace.join("\n")
29 when EOFError, Errno::ECONNRESET, Errno::EPIPE, Errno::EINVAL,
30 Errno::EBADF, Errno::ENOTCONN
31 # swallow error if client shuts down one end or disconnects
32 when Unicorn::HttpParserError
33 Rainbows::Const::ERROR_400_RESPONSE # try to tell the client they're bad
34 when IOError # HttpParserError is an IOError
37 Rainbows::Const::ERROR_500_RESPONSE