Skip to content

Commit 03d4ec4

Browse files
committed
impl Future for OnUpgrade
1 parent 7998e25 commit 03d4ec4

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/upgrade.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,20 +184,16 @@ impl Future for OnUpgrade {
184184
type Output = Result<Upgraded, crate::Error>;
185185

186186
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
187-
unimplemented!()
188-
/*
189187
match self.rx {
190-
Some(ref mut rx) => match Pin::new(rx).poll(cx) {
191-
Poll::Pending => Poll::Pending,
192-
Ok(Async::Ready(Ok(upgraded))) => Ok(Async::Ready(upgraded)),
193-
Ok(Async::Ready(Err(err))) => Err(err),
188+
Some(ref mut rx) => Pin::new(rx).poll(cx).map(|res| match res {
189+
Ok(Ok(upgraded)) => Ok(upgraded),
190+
Ok(Err(err)) => Err(err),
194191
Err(_oneshot_canceled) => Err(
195192
crate::Error::new_canceled().with(UpgradeExpected(()))
196193
),
197-
},
198-
None => Err(crate::Error::new_user_no_upgrade()),
194+
}),
195+
None => Poll::Ready(Err(crate::Error::new_user_no_upgrade())),
199196
}
200-
*/
201197
}
202198
}
203199

0 commit comments

Comments
 (0)