main
_ 2025-02-23 19:30:26 -06:00
parent 4d018413f8
commit 425503d66d
1 changed files with 22 additions and 26 deletions

View File

@ -42,36 +42,32 @@ impl App {
fn step(&mut self, cx: &mut Context<'_>) -> Result<()> {
let mut stream = pin!(&mut self.stream);
match <_ as futures_sink::Sink<Bytes>>::poll_ready(stream.as_mut(), cx) {
Poll::Pending => {}
Poll::Ready(result) => {
result?;
if let Some(frame) = self.client.poll_send() {
stream
.as_mut()
.start_send(frame)
.context("stream.start_send")?;
tracing::debug!("Started send");
}
match <_ as futures_sink::Sink<Bytes>>::poll_flush(stream.as_mut(), cx) {
Poll::Pending => {}
Poll::Ready(result) => {
result.context("poll_flush")?;
}
if let Poll::Ready(result) =
<_ as futures_sink::Sink<Bytes>>::poll_ready(stream.as_mut(), cx)
{
result?;
if let Some(frame) = self.client.poll_send() {
stream
.as_mut()
.start_send(frame)
.context("stream.start_send")?;
tracing::debug!("Started send");
}
match <_ as futures_sink::Sink<Bytes>>::poll_flush(stream.as_mut(), cx) {
Poll::Pending => {}
Poll::Ready(result) => {
result.context("poll_flush")?;
}
}
}
match stream.as_mut().poll_next(cx) {
Poll::Pending => {}
Poll::Ready(frame_opt) => {
let frame = frame_opt.context("Server closed cxn")?;
cx.waker().wake_by_ref();
let frame = frame.context("network framing decode")?;
self.client
.handle_frame(frame.into())
.context("client.handle_frame")?;
}
if let Poll::Ready(frame_opt) = stream.as_mut().poll_next(cx) {
let frame = frame_opt.context("Server closed cxn")?;
cx.waker().wake_by_ref();
let frame = frame.context("network framing decode")?;
self.client
.handle_frame(frame.into())
.context("client.handle_frame")?;
}
if self.timer.poll_tick(cx).is_ready() {