Catch exception in on_read

This commit is contained in:
Omar Roth 2019-11-23 18:11:54 -05:00
parent 7f2ecbfcdc
commit aa94a6ea1b
1 changed files with 3 additions and 2 deletions

View File

@ -83,11 +83,12 @@ class QUIC::Client
bytes_read = LibLsquic.stream_read(s, buffer, buffer.size)
if bytes_read > 0
if stream_ctx.writer && !stream_ctx.writer.try &.closed?
begin
stream_ctx.writer.try &.write buffer[0, bytes_read]
else
rescue ex
LibLsquic.stream_shutdown(s, 0)
LibLsquic.stream_wantread(s, 0)
return Box.box(stream_ctx)
end
elsif bytes_read == 0
LibLsquic.stream_shutdown(s, 0)