Simplify implementation of scheduler io_read
and io_write
. (#6527)
This commit is contained in:
parent
4e29ca0c40
commit
04d291a490
Notes:
git
2022-10-12 11:56:58 +09:00
Merged-By: ioquatix <samuel@codeotaku.com>
@ -269,15 +269,14 @@ class IOBufferScheduler < Scheduler
|
||||
total = 0
|
||||
io.nonblock = true
|
||||
|
||||
while length >= 0
|
||||
while true
|
||||
maximum_size = buffer.size - offset
|
||||
|
||||
result = blocking{buffer.read(io, maximum_size, offset)}
|
||||
|
||||
if result > 0
|
||||
total += result
|
||||
offset += result
|
||||
break if result >= length
|
||||
break if total >= length
|
||||
elsif result == 0
|
||||
break
|
||||
elsif result == EAGAIN
|
||||
@ -298,15 +297,14 @@ class IOBufferScheduler < Scheduler
|
||||
total = 0
|
||||
io.nonblock = true
|
||||
|
||||
while length >= 0
|
||||
while true
|
||||
maximum_size = buffer.size - offset
|
||||
|
||||
result = blocking{buffer.write(io, maximum_size, offset)}
|
||||
|
||||
if result > 0
|
||||
total += result
|
||||
offset += result
|
||||
break if result >= length
|
||||
break if total >= length
|
||||
elsif result == 0
|
||||
break
|
||||
elsif result == EAGAIN
|
||||
|
Loading…
x
Reference in New Issue
Block a user