Skip to content

Commit

Permalink
Brad's feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmreding committed Aug 30, 2024
1 parent 479f855 commit f3f9e1e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/grpc_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ namespace grpc_labview

//---------------------------------------------------------------------
//---------------------------------------------------------------------
static bool ichar_equals(char a, char b)
{
return std::tolower(static_cast<unsigned char>(a)) == std::tolower(static_cast<unsigned char>(b));
}

static bool IsLoopbackAddress(const char* address)
{
std::string hostname(address);
Expand All @@ -50,16 +45,15 @@ namespace grpc_labview
}
}

std::string localhost("localhost");
bool isLoopback = hostname.size() == localhost.size() && std::equal(hostname.begin(), hostname.end(), localhost.begin(), ichar_equals);
bool isLoopback = hostname == "localhost" || hostname == "LOCALHOST";
if (!isLoopback)
{
try
{
asio::ip::address ip_address = asio::ip::make_address(hostname);
isLoopback = ip_address.is_loopback();
}
catch (std::exception)
catch (std::exception&)
{
isLoopback = false;
}
Expand Down

0 comments on commit f3f9e1e

Please sign in to comment.