Closed jemc closed 1 year ago
FYI, @mneumann - I know you're using this in your MQTT library. You no longer need to call this method - your code will "just work" by simply removing it as described above.
However for now it's only deprecated - not removed; so for the time being your code will continue to work until the method is properly removed.
@jemc Thanks for pointing this out. I will change the code accordingly once you release an updated version of TCP.
@mneumann - Released!
There's no need for this method anymore. Loading pending reads into the read stream will now be handled automatically by the TCP engine, which will yield an
IO.Action.Read
action for each time a pending read is completed.So you can just remove this function call from your code and de-indent the body of your yield block, such that it becomes part of the outer code. If you need to know the number of bytes available, then you can call
io.read_stream.bytes_ahead_of_marker
to find out.For now, calling it will do nothing but yield once with the value of
io.read_stream.bytes_ahead_of_marker
to maintain compatibility. But the method will be removed soon.There's no reason why the library user needs to be the one to tell the engine to handle pending reads - it was a bad design from the start, but it also turns out to be a blocker for Windows support, wherein pending reads will work a bit differently. Also it was inconsistent with the
StdIn
library which doesn't have this method in its engine, so that's also cleared up now.