Continue name resolution fixing, add unit test
name_lookup() now returns all results given by getnameinfo(). When searching for a server, finding one matching address in the lookup-results is enough for a match. Also, added a test for name_lookup(). The test is minimal on its own, as hardcoded test cases are not generally valid.
This commit is contained in:
@ -172,12 +172,13 @@ private:
|
||||
class DNSResolver
|
||||
{
|
||||
public:
|
||||
std::string resolve_server(const std::string& host);
|
||||
using StringSet = std::unordered_set<std::string>;
|
||||
StringSet resolve_server(const std::string& host);
|
||||
|
||||
private:
|
||||
struct MapElement
|
||||
{
|
||||
std::string address;
|
||||
StringSet addresses; // A hostname can map to multiple addresses
|
||||
mxb::TimePoint timestamp;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user