Skip to content
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

fix(quic): Trigger Quic as Transport wakeup on dial #3306

Merged
merged 7 commits into from
Jan 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions transports/quic/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub struct GenTransport<P: Provider> {
listeners: SelectAll<Listener<P>>,
/// Dialer for each socket family if no matching listener exists.
dialer: HashMap<SocketFamily, Dialer>,
dialer_waker: Option<Waker>,
}

impl<P: Provider> GenTransport<P> {
Expand All @@ -84,6 +85,7 @@ impl<P: Provider> GenTransport<P> {
quinn_config,
handshake_timeout,
dialer: HashMap::new(),
dialer_waker: None,
support_draft_29,
}
}
Expand Down Expand Up @@ -161,6 +163,9 @@ impl<P: Provider> Transport for GenTransport<P> {
let dialer = match self.dialer.entry(socket_family) {
Entry::Occupied(occupied) => occupied.into_mut(),
Entry::Vacant(vacant) => {
if let Some(waker) = self.dialer_waker.take() {
waker.wake();
}
vacant.insert(Dialer::new::<P>(self.quinn_config.clone(), socket_family)?)
}
};
Expand Down Expand Up @@ -200,6 +205,8 @@ impl<P: Provider> Transport for GenTransport<P> {
errored.push(*key);
}
}
self.dialer_waker = Some(cx.waker().clone());

for key in errored {
// Endpoint driver of dialer crashed.
// Drop dialer and all pending dials so that the connection receiver is notified.
Expand Down