Ticket #5756 (closed Bugs: fixed)
read_some() with null_buffers blocks in non-blocking mode
|Reported by:||Gennady Proskurin <gpr@…>||Owned by:||chris_kohlhoff|
|Milestone:||To Be Determined||Component:||asio|
I want to poll socket for readability (the same as calling POSIX poll or select with zero timeout), to just know if it is readable:
- call sock.non_blocking(true)
- call read_some with null_buffers()
- it blocks
If I change null_buffers() to some read buffer, all works fine, would_block error is returned. The correct behaviour, I think, is to return immediately with corresponding error (no error if socket is readable, would_block if it is not).
At least tcp socket and posix::stream_descriptor are affected, not tested for other sockets. Also not tested write_some(), not sure if it is affected.
test program attached