Method: Whiskey::Server#handle_connection
- Defined in:
- lib/whiskey/server.rb
#handle_connection(socket) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/whiskey/server.rb', line 63 def handle_connection(socket) connection = Connection.new(socket) Whiskey.logger.info "New connection created from #{connection.id}" begin Handler.new(connection).handle rescue => connection_error Whiskey.logger.error connection_error ensure # If the connection has been broken, this might not work: Errno::EPIPE begin socket.write Serializer.new(Error.new(:internal_server_error).to_hash).data rescue => socket_error Whiskey.logger.error socket_error end socket.close end end |