Merge pull request #5 from vhuynh3000/fix_closed_stream_with_open_engine

Remove the ensure block and close the socket only if there is no exception
This commit is contained in:
Perflyst 2021-02-08 19:38:01 +01:00 committed by GitHub
commit cd6ec66292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -225,11 +225,10 @@ module QUIC
LibLsquic.engine_packet_in(engine, buffer[0, bytes_read], bytes_read, socket.local_address, socket.remote_address, Box.box(socket), 0) if bytes_read != 0
LibLsquic.engine_process_conns(engine)
end
rescue IO::Error
# may have already been closed
ensure
@socket.try &.close
@socket = nil
rescue IO::Error
# may have already been closed
end
end