Skip to content

Commit 03c9dcb

Browse files
committed
Move flush back into synchronized output.
1 parent 7ccef53 commit 03c9dcb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/protocol/http2/connection.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,20 +215,20 @@ def receive_goaway(frame)
215215
def write_frame(frame)
216216
synchronize do
217217
@framer.write_frame(frame)
218+
219+
# I tried moving this outside the synchronize block but it caused a deadlock.
220+
@framer.flush
218221
end
219-
220-
# The IO is already synchronized, and we don't want additional contention.
221-
@framer.flush
222222
end
223223

224224
def write_frames
225225
if @framer
226226
synchronize do
227227
yield @framer
228+
229+
# See note above.
230+
@framer.flush
228231
end
229-
230-
# See above note.
231-
@framer.flush
232232
else
233233
raise EOFError, "Connection closed!"
234234
end

0 commit comments

Comments
 (0)