Skip to content

Commit

Permalink
Update Connections.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored Feb 17, 2024
1 parent 6c47687 commit 56c6531
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/Connections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,6 @@ end
function read_to_buffer(c::Connection, sizehint=4096)
buf = c.buffer

# Reset the buffer if it is empty.
if bytesavailable(buf) == 0
buf.size = 0
buf.ptr = 1
end

# Wait for data.
if eof(c.io)
throw(EOFError())
Expand All @@ -225,8 +219,8 @@ function read_to_buffer(c::Connection, sizehint=4096)
n = min(sizehint, bytesavailable(c.io))
buf = c.buffer
p, n = Base.alloc_request(buf, UInt(n))
GC.@preserve buf unsafe_read(c.io, p, min(n, bytesavailable(c.io)))
buf.size += n
n = GC.@preserve buf unsafe_read(c.io, p, min(n, bytesavailable(c.io)))
Base.notify_filled(buf, Int(n))
nothing
end

Expand Down

0 comments on commit 56c6531

Please sign in to comment.