perf(http2): don't register callback with main h2 client task

This commit is contained in:
Sean McArthur
2019-02-25 17:27:51 -08:00
parent 1161479945
commit 1e6603353e
2 changed files with 13 additions and 6 deletions

View File

@@ -178,14 +178,21 @@ pub enum Callback<T, U> {
}
impl<T, U> Callback<T, U> {
pub fn poll_cancel(&mut self) -> Poll<(), ()> {
pub(crate) fn is_canceled(&self) -> bool {
match *self {
Callback::Retry(ref tx) => tx.is_canceled(),
Callback::NoRetry(ref tx) => tx.is_canceled(),
}
}
pub(crate) fn poll_cancel(&mut self) -> Poll<(), ()> {
match *self {
Callback::Retry(ref mut tx) => tx.poll_cancel(),
Callback::NoRetry(ref mut tx) => tx.poll_cancel(),
}
}
pub fn send(self, val: Result<U, (::Error, Option<T>)>) {
pub(crate) fn send(self, val: Result<U, (::Error, Option<T>)>) {
match self {
Callback::Retry(tx) => {
let _ = tx.send(val);