mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-28 00:00:11 +02:00
test: fetch actions from mock handle before write (#5814)
This commit is contained in:
@@ -409,6 +409,20 @@ impl AsyncWrite for Mock {
|
||||
// If a sleep is set, it has already fired
|
||||
self.inner.sleep = None;
|
||||
|
||||
if self.inner.actions.is_empty() {
|
||||
match self.inner.poll_action(cx) {
|
||||
Poll::Pending => {
|
||||
// do not propagate pending
|
||||
}
|
||||
Poll::Ready(Some(action)) => {
|
||||
self.inner.actions.push_back(action);
|
||||
}
|
||||
Poll::Ready(None) => {
|
||||
panic!("unexpected write");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
match self.inner.write(buf) {
|
||||
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
|
||||
if let Some(rem) = self.inner.remaining_wait() {
|
||||
|
||||
Reference in New Issue
Block a user