Skip to content

Commit

Permalink
Handle #eagerly_finish's errors properly
Browse files Browse the repository at this point in the history
  • Loading branch information
evanphx committed Jul 24, 2012
1 parent 6cb5479 commit 9844daa
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/puma/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,25 @@ def run(background=true)
@status = :run

@thread_pool = ThreadPool.new(@min_threads, @max_threads) do |client|
if client.eagerly_finish
process_client client

process_now = false

begin
process_now = client.eagerly_finish
rescue HttpParserError => e
@events.parse_error self, client.env, e
rescue EOFError
client.close
else
@reactor.add client
if process_now
process_client client
else
@reactor.add client
end
end
end

@reactor = Reactor.new @events, @thread_pool
@reactor = Reactor.new self, @thread_pool

@reactor.run_in_thread

Expand Down

0 comments on commit 9844daa

Please sign in to comment.