Use flush combinator

This commit is contained in:
Steven Fackler
2019-08-02 20:30:36 -07:00
parent 26a17ac4ed
commit 048e91a57d

View File

@@ -23,9 +23,7 @@ where
frontend::cancel_request(process_id, secret_key, &mut buf);
stream.write_all(&buf).await.map_err(Error::io)?;
future::poll_fn(|cx| Pin::new(&mut stream).poll_flush(cx))
.await
.map_err(Error::io)?;
stream.flush().await.map_err(Error::io)?;
future::poll_fn(|cx| Pin::new(&mut stream).poll_shutdown(cx))
.await
.map_err(Error::io)?;