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
Connection established and closed callbacks #40
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tewinget
force-pushed
the
conn-state-callbacks
branch
from
September 6, 2023 18:41
71cc4a1
to
26d1fd7
Compare
dr7ana
force-pushed
the
conn-state-callbacks
branch
from
September 11, 2023 21:45
4b3fef1
to
3ea90d3
Compare
tewinget
force-pushed
the
conn-state-callbacks
branch
3 times, most recently
from
September 12, 2023 20:59
3d9c072
to
38e0075
Compare
jagerman
reviewed
Sep 13, 2023
Connection established is called when the connection has confirmed the TLS handshake; server does this on ngtcp2 handshake "complete" after sending the final packet for the handshake to the client which will then call ngtcp2 handshake "confirmed". Connection closed callback is called when a connection closes for any reason, including that it timed out and was never actually established (thus acting as a "connection attempt failed" signal as well). In order to have a connection timeout call connection closed, a handshake timeout needed to be set in ngtcp2 (the default was funtionally infinite). 5s should be sufficient, but this can be made configurable at a later time. Tests which were confirming connection establishment or failure have been updated to use the new callbacks.
- no structs for open/close callbacks - added `error.hpp` - reworked bool_waiter in unit tests - little bit of template magic from jason
- Sometimes when ngtcp2 does not want a connection close packet written, we delete the connection from the endpoint's internal map - In these cases, we still want to notify the calling endpoint that the connection was closed
tewinget
force-pushed
the
conn-state-callbacks
branch
2 times, most recently
from
September 18, 2023 17:45
e7d4074
to
5e618a4
Compare
dr7ana
reviewed
Sep 18, 2023
dr7ana
approved these changes
Sep 18, 2023
jagerman
reviewed
Sep 18, 2023
jagerman
reviewed
Sep 18, 2023
jagerman
reviewed
Sep 18, 2023
For whatever reason, sometimes ngtcp2 gives a time point in the past when asked when to wake it up; this was resulting in us never waking it. Normally this is fine, as an incoming packet wakes it and we do't notice, but if no packets come in, new connections we make can fail to timeout correctly. This works around that issue by doing a 0µs timeout if the timeout would be negative.
we need to keep 'closing' connections around for a bit so we can drop any straggler packets. also, if we 'drop connection' here we get multiple calls to the connection closed callback, which is not ideal
also use ngtcp2_ccerr_set_application_error rather then ...set_liberr if the close is an application requested close rather than protocol error or similar supply connection close error code to user-defined connection closed cb adds connection close callback test
jagerman
reviewed
Sep 18, 2023
jagerman
reviewed
Sep 18, 2023
jagerman
reviewed
Sep 18, 2023
jagerman
reviewed
Sep 18, 2023
jagerman
approved these changes
Sep 18, 2023
tewinget
force-pushed
the
conn-state-callbacks
branch
from
September 18, 2023 19:47
5e618a4
to
0099dba
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
builds on #39