You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b57dc02
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: lib/async/http/protocol/http2/connection.rb
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -47,12 +47,21 @@ def synchronize(&block)
47
47
48
48
# Write a single frame, deferring stop until the frame is written.
49
49
defwrite_frame(frame)
50
-
Task.current.defer_stop{super}
50
+
defer_stop{super}
51
51
end
52
52
53
53
# Write multiple frames, deferring stop until the frames are written.
54
54
defwrite_frames
55
-
Task.current.defer_stop{super}
55
+
defer_stop{super}
56
+
end
57
+
58
+
# A fiber may be running under the scheduler without being an Async task, e.g. an `Enumerator` reading a response body, in which case there is no task to defer stopping.
59
+
privatedefdefer_stop(&block)
60
+
iftask=Task.current?
61
+
task.defer_stop(&block)
62
+
else
63
+
yield
64
+
end
56
65
end
57
66
58
67
# @returns [String] A string representation of this connection.
0 commit comments