Currently, poll_close is not checking for io::ErrorKind::WouldBlock on error, and instead it is bumbled up.
For instance, calling the close helper from SinkExt:
ws.close().await.unwrap();
will cause a panic when WouldBlock occurs, instead of simply polling as expected.
This patch addresses this by returning Poll::Pending and then polling write_pending to drive the close operation to completion.
Currently,
poll_close
is not checking forio::ErrorKind::WouldBlock
on error, and instead it is bumbled up. For instance, calling theclose
helper fromSinkExt
:will cause a panic when
WouldBlock
occurs, instead of simply polling as expected.This patch addresses this by returning
Poll::Pending
and then pollingwrite_pending
to drive the close operation to completion.