Skip to content

Commit b240a83

Browse files
committed
Update Connections.jl
1 parent d4a8c92 commit b240a83

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/Connections.jl

+2-8
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,6 @@ end
210210
function read_to_buffer(c::Connection, sizehint=4096)
211211
buf = c.buffer
212212

213-
# Reset the buffer if it is empty.
214-
if bytesavailable(buf) == 0
215-
buf.size = 0
216-
buf.ptr = 1
217-
end
218-
219213
# Wait for data.
220214
if eof(c.io)
221215
throw(EOFError())
@@ -225,8 +219,8 @@ function read_to_buffer(c::Connection, sizehint=4096)
225219
n = min(sizehint, bytesavailable(c.io))
226220
buf = c.buffer
227221
p, n = Base.alloc_request(buf, UInt(n))
228-
GC.@preserve buf unsafe_read(c.io, p, min(n, bytesavailable(c.io)))
229-
buf.size += n
222+
n = GC.@preserve buf unsafe_read(c.io, p, min(n, bytesavailable(c.io)))
223+
Base.notify_filled(buf, Int(n))
230224
nothing
231225
end
232226

0 commit comments

Comments
 (0)