-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # 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. |
Just to drop in with an update, I've been adding library support in My current plan is roughly:
The awkward part will be handling the types - I'm thinking, probably will need to box everything in my wrapper future to avoid generic pollution breaking the API. And then maybe a new Anyway will be looking at that next week, hopefully. |
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