Skip to content

Commit

Permalink
common: cleanup address_helper
Browse files Browse the repository at this point in the history
Signed-off-by: Shinobu Kinjo <[email protected]>
  • Loading branch information
shinobu-x committed Dec 22, 2017
1 parent f9eea16 commit ba9d07f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/common/address_helper.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* address_helper.cc
*
Expand All @@ -15,7 +17,6 @@
int entity_addr_from_url(entity_addr_t *addr /* out */, const char *url)
{
using namespace boost;
using std::endl;

regex expr("(tcp|rdma)://([^:]*):([\\d]+)");
cmatch m;
Expand All @@ -27,8 +28,7 @@ int entity_addr_from_url(entity_addr_t *addr /* out */, const char *url)
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
addrinfo *res;
int error = getaddrinfo(host.c_str(), NULL, &hints, &res);
if (! error) {
if (!getaddrinfo(host.c_str(), nullptr, &hints, &res)) {
addr->set_sockaddr((sockaddr*)res->ai_addr);
addr->set_port(std::atoi(port.c_str()));
freeaddrinfo(res);
Expand Down

0 comments on commit ba9d07f

Please sign in to comment.