refactor
parent
4d018413f8
commit
425503d66d
|
@ -42,9 +42,9 @@ impl App {
|
||||||
|
|
||||||
fn step(&mut self, cx: &mut Context<'_>) -> Result<()> {
|
fn step(&mut self, cx: &mut Context<'_>) -> Result<()> {
|
||||||
let mut stream = pin!(&mut self.stream);
|
let mut stream = pin!(&mut self.stream);
|
||||||
match <_ as futures_sink::Sink<Bytes>>::poll_ready(stream.as_mut(), cx) {
|
if let Poll::Ready(result) =
|
||||||
Poll::Pending => {}
|
<_ as futures_sink::Sink<Bytes>>::poll_ready(stream.as_mut(), cx)
|
||||||
Poll::Ready(result) => {
|
{
|
||||||
result?;
|
result?;
|
||||||
if let Some(frame) = self.client.poll_send() {
|
if let Some(frame) = self.client.poll_send() {
|
||||||
stream
|
stream
|
||||||
|
@ -60,11 +60,8 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
match stream.as_mut().poll_next(cx) {
|
if let Poll::Ready(frame_opt) = stream.as_mut().poll_next(cx) {
|
||||||
Poll::Pending => {}
|
|
||||||
Poll::Ready(frame_opt) => {
|
|
||||||
let frame = frame_opt.context("Server closed cxn")?;
|
let frame = frame_opt.context("Server closed cxn")?;
|
||||||
cx.waker().wake_by_ref();
|
cx.waker().wake_by_ref();
|
||||||
let frame = frame.context("network framing decode")?;
|
let frame = frame.context("network framing decode")?;
|
||||||
|
@ -72,7 +69,6 @@ impl App {
|
||||||
.handle_frame(frame.into())
|
.handle_frame(frame.into())
|
||||||
.context("client.handle_frame")?;
|
.context("client.handle_frame")?;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if self.timer.poll_tick(cx).is_ready() {
|
if self.timer.poll_tick(cx).is_ready() {
|
||||||
cx.waker().wake_by_ref();
|
cx.waker().wake_by_ref();
|
||||||
|
|
Loading…
Reference in New Issue