Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Wang <[email protected]>
  • Loading branch information
GehaFearless and empiredan committed Feb 8, 2024
1 parent 449ef32 commit f818d64
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/runtime/rpc/dns_resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,4 @@ rpc_address dns_resolver::resolve_address(const host_port &hp)
}
}

dns_resolver::~dns_resolver() { _dns_cache.clear(); }

} // namespace dsn
2 changes: 1 addition & 1 deletion src/runtime/rpc/dns_resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class dns_resolver : public utils::singleton<dns_resolver>

private:
dns_resolver();
~dns_resolver();
~dns_resolver() = default;

friend class utils::singleton<dns_resolver>;

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/rpc/group_address.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class rpc_group_address : public ref_counter
void set_leader(rpc_address addr);
bool remove(rpc_address addr) WARN_UNUSED_RESULT;
bool contains(rpc_address addr) const WARN_UNUSED_RESULT;
int count();
int count() const;

const std::vector<rpc_address> &members() const { return _members; }
rpc_address random_member() const
Expand Down Expand Up @@ -194,7 +194,7 @@ inline bool rpc_group_address::contains(rpc_address addr) const
return _members.end() != std::find(_members.begin(), _members.end(), addr);
}

inline int rpc_group_address::count()
inline int rpc_group_address::count() const
{
alr_t l(_lock);
return _members.size();
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/test/host_port_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ TEST(host_port_test, dns_resolver)
{
{
host_port hp("localhost", 8080);
auto addr = dns_resolver::instance().resolve_address(hp);
const auto &addr = dns_resolver::instance().resolve_address(hp);
ASSERT_TRUE(rpc_address("127.0.0.1", 8080) == addr ||
rpc_address("127.0.1.1", 8080) == addr);
}
Expand All @@ -247,8 +247,8 @@ TEST(host_port_test, dns_resolver)
host_port hp2("localhost", 8081);
g_hp->set_leader(hp2);

auto addr_grp = dns_resolver::instance().resolve_address(hp_grp);
auto g_addr = addr_grp.group_address();
const auto &addr_grp = dns_resolver::instance().resolve_address(hp_grp);
const auto *const g_addr = addr_grp.group_address();

ASSERT_EQ(g_addr->is_update_leader_automatically(), g_hp->is_update_leader_automatically());
ASSERT_STREQ(g_addr->name(), g_hp->name());
Expand Down

0 comments on commit f818d64

Please sign in to comment.