Skip to content

Commit

Permalink
Add support for defer_stop.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Mar 27, 2024
1 parent f681cd4 commit cf288fe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/async/http/protocol/http1/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def each(task: Task.current)
return
end

begin
task.defer_stop do
# If a response was generated, send it:
if response
trailer = response.headers.trailer!
Expand Down
2 changes: 1 addition & 1 deletion lib/async/http/protocol/http2/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def read_in_background(parent: Task.current)

task.annotate("#{version} reading data for #{self.class}.")

begin
task.defer_stop do
while !self.closed?
self.consume_window
self.read_frame
Expand Down
2 changes: 1 addition & 1 deletion lib/async/http/protocol/http2/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def each(task: Task.current)

@count += 1

begin
task.defer_stop do
response = yield(request)
rescue
# We need to close the stream if the user code blows up while generating a response:
Expand Down

0 comments on commit cf288fe

Please sign in to comment.