Repository navigation
ssl: Stop the sender socket side if error - #10011
Conversation
When socket reports an error close down the socket sender process to avoid trying to send something else.
CT Test Results 2 files 66 suites 26m 18s ⏱️ Results for commit e4a66c1. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts
// Erlang/OTP Github Action Bot |
b91746e to
de506f6
Compare
de506f6 to
b2a2e8b
Compare
Socket needs to bind address before connection, make sure to bind to the correct outgoing address.
b2a2e8b to
e4a66c1
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that when a socket error occurs, the sender process shuts down, and it also adds the ability to bind an explicit outbound port for TCP/TLS connections.
- Extracts and applies a user-specified
portoption viaget_port/1intls_socket_tcp. - Updates
tls_senderstate machine to always invokedeath_row_shutdownon errors. - Adds outbound port binding in
inet_epmd_tls_socketbefore connecting.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/ssl/src/tls_socket_tcp.erl | Added get_port/1 to capture outbound port and passed a BindAddr map through connect_1. |
| lib/ssl/src/tls_sender.erl | Unified error handling to always call death_row_shutdown and removed special-case branches. |
| lib/ssl/src/inet_epmd_tls_socket.erl | Introduced BindAddress construction and bound the socket to it before connect. |
Comments suppressed due to low confidence (4)
lib/ssl/src/tls_socket_tcp.erl:320
- Consider adding a brief @SPEC and doc comment for
get_port/1to explain the returned tuple{OutPort, Opts}and how theportoption is consumed.
get_port(Opts0) ->
lib/ssl/src/tls_sender.erl:573
- The new unified error clause always triggers
death_row_shutdown; add or update comments to clarify that non-distribution errors also intentionally shut down the sender.
{error, _} = Error ->
lib/ssl/src/tls_sender.erl:573
- There are no new tests covering the unified shutdown behavior on errors; please add unit/integration tests to verify that the sender process stops as expected for both distribution and non-distribution errors.
{error, _} = Error ->
lib/ssl/src/tls_sender.erl:741
- The
send_post_handshake_data/…case now only handlesokand{error, Reason}; verify that no other return shapes can occur to prevent an unhandled clause runtime crash.
{error, Reason} ->
When socket reports an error close down the socket sender process to avoid trying to send something else.