-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(WIP) feat: add support for processing handshake packets async via vacation
#99
base: main
Are you sure you want to change the base?
Conversation
…heavy-future-executor
Pushed a new change that adds an enum to determine whether to process packets async. Also updated to reflect some changes in the dependency crate (now called |
…o process packets async
vacation
It became too big and too intrusive for me. i believe there is a non-intrusive way to handle it. like struct ComputeHeavy<F: Future, P> {
source: F,
prepare: P,
execute: Option<Box<dyn Future<Output = F::Output>>>
}
impl<F, P> Future for ComputeHeavy<F, P>
where
F: Future,
P: Fn(&mut F) -> Poll<()>
{
// ..
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
if let Some(exec) = self.execute.as_mut() {
// poll exec
}
(self.prepare)(self.source)?;
self.execute
.insert(execute(|| self.source.poll(cx))))
.poll(cx)
}
}
let mut fut = acceptor.accept(io);
let tls_stream = ComputeHeavy::new(
// source
fut,
// prepare
|fut| fut.get_mut().unwrap().poll_fill_buf(cx)
).await;
If want to expose a |
Thanks for the read-through + advice, @quininer ! I'll try out the suggested approach. |
WIP, I plan to add:
Also have yet to publish the new dependency crate, so all CI will fail :)
Staging this now to demonstrate what it would be like to use jlizen/vacation#9 in practice. Also for early feedback from my colleagues (or
tokio-rustls
maintainers if you have time, no rush though, I'll cut an official PR after it's polished).closes #94