Copilot commented on code in PR #3544:
URL: https://github.com/apache/brpc/pull/3544#discussion_r4006448753
##########
src/brpc/socket.cpp:
##########
@@ -1293,9 +1299,11 @@ int Socket::Connect(const timespec* abstime,
return -1;
#endif
}
- if (local_side().ip != butil::IP_ANY) {
- struct sockaddr_storage cli_addr;
- if (butil::endpoint2sockaddr(local_side(), &cli_addr, &addr_size) !=
0) {
+ // Bind to the configured client source IP whenever it was requested.
+ if (_bind_local) {
+ struct sockaddr_storage cli_addr{};
+ butil::EndPoint bind_point(local_side().ip, 0);
Review Comment:
This unconditionally changes the `SocketOptions.local_side` contract for
callers that provide a non-zero source port: the initial connection now binds
`local_side().ip:0` instead of the requested endpoint, whereas the previous
code passed the full endpoint to `bind()`. Keep the configured port for the
initial connection and track whether it was ephemeral before clearing it during
revival; otherwise this is an API behavior regression outside the `client_host`
path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]