1 # -*- encoding: binary -*-
7 # if we get any error, try to write something back to the client
8 # assuming we haven't closed the socket, but don't get hung up
9 # if the socket is already closed or broken. We'll always ensure
10 # the socket is closed at the end of this function
13 if io.respond_to?(:kgio_trywrite)
16 io.write_nonblock(msg)
23 G.server.logger.error "app error: #{e.inspect}"
24 G.server.logger.error e.backtrace.join("\n")
28 def self.listen_loop(e)
30 G.server.logger.error "listen loop error: #{e.inspect}."
31 G.server.logger.error e.backtrace.join("\n")
37 when EOFError, Errno::ECONNRESET, Errno::EPIPE, Errno::EINVAL,
38 Errno::EBADF, Errno::ENOTCONN
39 # swallow error if client shuts down one end or disconnects
40 when Rainbows::Response416
41 Rainbows::Const::ERROR_416_RESPONSE
42 when Unicorn::HttpParserError
43 Rainbows::Const::ERROR_400_RESPONSE # try to tell the client they're bad
44 when IOError # HttpParserError is an IOError
47 Rainbows::Const::ERROR_500_RESPONSE