Skip to content

Commit

Permalink
[NFC] remove unreferenced function ResolveIPV4HostName
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D104856
  • Loading branch information
serge-sans-paille committed Jun 25, 2021
1 parent 96f6873 commit f7b1fa6
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions lldb/tools/debugserver/source/RNBSocket.cpp
Expand Up @@ -30,38 +30,6 @@
#include "lockdown.h"
#endif

/* Once we have a RNBSocket object with a port # specified,
this function is called to wait for an incoming connection.
This function blocks while waiting for that connection. */

bool ResolveIPV4HostName(const char *hostname, in_addr_t &addr) {
if (hostname == NULL || hostname[0] == '\0' ||
strcmp(hostname, "localhost") == 0 ||
strcmp(hostname, "127.0.0.1") == 0) {
addr = htonl(INADDR_LOOPBACK);
return true;
} else if (strcmp(hostname, "*") == 0) {
addr = htonl(INADDR_ANY);
return true;
} else {
// See if an IP address was specified as numbers
int inet_pton_result = ::inet_pton(AF_INET, hostname, &addr);

if (inet_pton_result == 1)
return true;

struct hostent *host_entry = gethostbyname(hostname);
if (host_entry) {
std::string ip_str(
::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), &addr);
if (inet_pton_result == 1)
return true;
}
}
return false;
}

rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
PortBoundCallback callback,
const void *callback_baton) {
Expand Down

0 comments on commit f7b1fa6

Please sign in to comment.