Skip to content

Conversation

@prbprbprb
Copy link
Contributor

Previously the socket would never actually reach STATE_READY but it didn't matter.

This tidy-up makes the states and transitions more explicit and moves TLS metric logging to the correct place to prevent duplicate logging if waitForHandshake is called multiple times.

Also moves calling of the SSLSocket handshake listeners outside of the SSLEngine handshake callback, this means they can operate on the socket without causing re-entrant calls to wrap() etc. This behaviour isn't defined to be allowed anywhere and it doesn't work with the FD socket.

Finally tidied a bunch of IDEA warnings from SSLSocketTest and used assertThrows where possible.

Previously the socket would never actually reach STATE_READY
but it didn't matter.

This tidy-up makes the states and transitions more explicit
and moves TLS metric logging to the correct place to prevent
duplicate logging if waitForHandshake is called multiple times.

Also moves calling of the SSLSocket handshake listeners outside
of the SSLEngine handshake callback, this means they can
operate on the socket without causing re-entrant calls to wrap()
etc.  This behaviour isn't defined to be allowed anywhere and
it doesn't work with the FD socket.

Finally tidied a bunch of IDEA warnings from SSLSocketTest and
used assertThrows where possible.
@prbprbprb prbprbprb merged commit 79a17b7 into google:master Mar 29, 2023
@prbprbprb prbprbprb deleted the states branch March 29, 2023 14:02
prbprbprb pushed a commit to prbprbprb/conscrypt that referenced this pull request Apr 2, 2023
This is analogous to google#1120 and removes double-counting by only
counting metrics during explicit state changes.  There is a lot
more tidying up that could be done here, but as this class is
long deprecated, this change is kept to the minimum required to
ensure consistent counting between the EngineSocket and FdSocket.

Also incorporates the "failed" values from google#1123 to make analysis
clearer.

TODO(prb): Tested manually: We have no real tests to ensure
consistent stats counting.
prbprbprb added a commit that referenced this pull request Apr 3, 2023
This is analogous to #1120 and removes double-counting by only
counting metrics during explicit state changes.  There is a lot
more tidying up that could be done here, but as this class is
long deprecated, this change is kept to the minimum required to
ensure consistent counting between the EngineSocket and FdSocket.

Also incorporates the "failed" values from #1123 to make analysis
clearer.

TODO(prb): Tested manually: We have no real tests to ensure
consistent stats counting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants