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 Unicorn.log_error(Rainbows.server.logger, "app error", e)
19 def self.listen_loop(e)
20 Rainbows.alive or return
21 Unicorn.log_error(Rainbows.server.logger, "listen loop error", e)
27 when EOFError, Errno::ECONNRESET, Errno::EPIPE, Errno::EINVAL,
28 Errno::EBADF, Errno::ENOTCONN, Errno::ETIMEDOUT, Errno::EHOSTUNREACH
29 # swallow error if client shuts down one end or disconnects
30 when Unicorn::HttpParserError
31 "HTTP/1.1 400 Bad Request\r\n\r\n" # try to tell the client they're bad
32 when IOError # HttpParserError is an IOError
35 "HTTP/1.1 500 Internal Server Error\r\n\r\n"