372046933 commented on code in PR #3179:
URL: https://github.com/apache/brpc/pull/3179#discussion_r2659565929
##########
src/brpc/socket.cpp:
##########
@@ -1296,7 +1296,17 @@ int Socket::Connect(const timespec* abstime,
CHECK_EQ(0, butil::make_close_on_exec(sockfd));
// We need to do async connect (to manage the timeout by ourselves).
CHECK_EQ(0, butil::make_non_blocking(sockfd));
-
+ if (local_side().ip != butil::IP_ANY) {
+ struct sockaddr_storage cli_addr;
+ if (butil::endpoint2sockaddr(local_side(), &cli_addr, &addr_size) !=
0) {
+ PLOG(ERROR) << "Fail to get client sockaddr";
+ return -1;
+ }
+ if (::bind(sockfd, (struct sockaddr*)&cli_addr, addr_size) != 0) {
Review Comment:
bind确定了source IP,但是TX流量可以落在跟source IP不同的另一个IP所在的interface上
--
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]