refactor
parent
4d018413f8
commit
425503d66d
|
@ -42,9 +42,9 @@ 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) => {
|
||||
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
|
||||
|
@ -60,11 +60,8 @@ impl App {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
match stream.as_mut().poll_next(cx) {
|
||||
Poll::Pending => {}
|
||||
Poll::Ready(frame_opt) => {
|
||||
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")?;
|
||||
|
@ -72,7 +69,6 @@ impl App {
|
|||
.handle_frame(frame.into())
|
||||
.context("client.handle_frame")?;
|
||||
}
|
||||
}
|
||||
|
||||
if self.timer.poll_tick(cx).is_ready() {
|
||||
cx.waker().wake_by_ref();
|
||||
|
|
Loading…
Reference in New Issue