weberlo commented on a change in pull request #4281: [RUTNIME] Support C++ RPC
URL: https://github.com/apache/incubator-tvm/pull/4281#discussion_r344471883
##########
File path: src/common/socket.h
##########
@@ -203,17 +251,20 @@ class Socket {
}
/*!
* \brief try bind the socket to host, from start_port to end_port
+ * \param host host_address to bind the socket
* \param start_port starting port number to try
* \param end_port ending port number to try
* \return the port successfully bind to, return -1 if failed to bind any
port
*/
- inline int TryBindHost(int start_port, int end_port) {
+ inline int TryBindHost(std::string host, int start_port, int end_port) {
for (int port = start_port; port < end_port; ++port) {
- SockAddr addr("0.0.0.0", port);
+ SockAddr addr(host.c_str(), port);
if (bind(sockfd, reinterpret_cast<sockaddr*>(&addr.addr),
(addr.addr.ss_family == AF_INET6 ? sizeof(sockaddr_in6) :
sizeof(sockaddr_in))) == 0) {
return port;
+ } else {
+ LOG(WARNING) << "Bind failed to " << host << ":" << port;
Review comment:
```suggestion
LOG(WARNING) << "Bind failed to " << host << ":" << port;
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services