-
Notifications
You must be signed in to change notification settings - Fork 183
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
Correctly report TLS handshake when TCP Fast Open is enabled #1970
Conversation
Motivation: When TCP Fast Open socket option is enabled and available by the OS, client sends `ClientHello` message with the initial TCP handshake. We should trigger `onSecurityHandshake()` earlier in this case and give users another callback to see when the TCP handshake completes. Modifications: - Add `ConnectionObserver#onTcpHandshakeComplete()`; - Improve tests to verity new callback; - Adjust `ConnectionObserverInitializer` to trigger `onSecurityHandshake()` earlier when TCP Fast Open is enabled and available; Result: Users can observe TCP and TLS handshake behavior correctly when Fast Open is used.
/** | ||
* Callback when a TCP handshake completes. | ||
*/ | ||
default void onTcpHandshakeComplete() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend avoid using tcp
at this level bcz we could use the same abstractions for other protocols (udp, ..). Netty uses channelActive
terminology and we could use something similar here (e.g. onActive
, onConnectionActive
, ..)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, changed it to onTransportHandshakeComplete()
. Debated with myself if this callback really necessary or not. Discussed with @tkountis and he convinced me that it's a lot easier to understand API and events sequencing of the ConnectionObserver
if we have it. Thanks for discussion!
Motivation: When TCP Fast Open socket option is enabled and available by the OS, client sends `ClientHello` message with the initial TCP handshake. We should trigger `onSecurityHandshake()` earlier in this case and give users another callback to see when the TCP handshake completes. Modifications: - Add `ConnectionObserver#onTransportHandshakeComplete()`; - Improve tests to verity new callback; - Adjust `ConnectionObserverInitializer` to trigger `onSecurityHandshake()` earlier when TCP Fast Open is enabled and available; Result: Users can observe TCP and TLS handshake behavior correctly when Fast Open is used.
Motivation: apple#1969 and apple#1970 introduced two new callbacks for `ConnectionObserver` and added default impl for backward compatibility. We can clean up API in 0.42. Modifications: - Remove default impl for `onTransportHandshakeComplete()` and `streamIdAssigned`; Result: No default callback impls.
Motivation: apple#1970 removed a public ctor from `ConnectionObserverInitializer`. We should revert it back to make the class backward compatible. Modifications: - Revert `ConnectionObserverInitializer(ConnectionObserver, boolean)`; Result: `ConnectionObserverInitializer` is backward compatible.
Motivation: #1970 removed a public ctor from `ConnectionObserverInitializer`. We should revert it back to make the class backward compatible. Modifications: - Revert `ConnectionObserverInitializer(ConnectionObserver, boolean)`; Result: `ConnectionObserverInitializer` is backward compatible.
Motivation:
When TCP Fast Open socket option is enabled and available by the OS,
client sends
ClientHello
message with the initial TCP handshake. Weshould trigger
onSecurityHandshake()
earlier in this case and giveusers another callback to see when the TCP handshake completes.
Modifications:
ConnectionObserver#onTransportHandshakeComplete()
;ConnectionObserverInitializer
to triggeronSecurityHandshake()
earlier when TCP Fast Open is enabled andavailable;
Result:
Users can observe TCP and TLS handshake behavior correctly when
Fast Open is used.