Provide access to connection Waker to datagram Endpoint #1598
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
This waker allows datagram receiver/senders to wake up the connection,
which will re-poll the connection for interest in sending. When
implementing a custom datagram Receiver which wants to schedule a reply
datagram, this Waker or something like it is necessary to indirect the
wakeup of the connection and subsequent call to the Sender's
on_transmit.
This is a waker and not a connection handle for two reasons:
which avoids keeping the connection data indefinitely alive for cases
where the Waker is stored within the Sender or Receiver.
access to an application handle to the connection.
Note that applications still must retain the Connection or a Handle to
it: when the last application handle closes, the connection is also
closed, even if there are Wakers for that connection still around.
In practice this seems useful as it allows bounding the number of active
connections with an Endpoint and the extra waste of connection handles
is unlikely to be significant.
Call-outs:
Default
impls forConnectionInfo
andPreConnectionInfo
. This is intended to avoid needing to provide a default for the Waker field, which doesn't seem like it has an obvious default (a no-op waker, perhaps?). I believe these impls exist for construction outside of s2n-quic-owned crates as a way to construct despite the non_exhaustive annotations, but I'm not sure they are actually a good idea. Open to alternatives here.This is sort of further iterating on options around #1565 -- it's not really directly related but provides another way of bypassing the normal structure.
Testing:
No dedicated tests are added. I'm not sure if there are tests related to connection wakeup & polling today -- it seems like the functionality added here would need to build essentially a full Endpoint to test it well. Happy to add that if pointed to some existing framework for it.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.