Skip to content

Commit

Permalink
Merge pull request #98 from smatsuodev/listener-chore
Browse files Browse the repository at this point in the history
Listener のエラーハンドリングの微修正
  • Loading branch information
harsssh authored Jan 10, 2025
2 parents 90e56f8 + 15629f3 commit a414df3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib/transport/listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ Result<addrinfo *, std::string> resolveAddress(const std::string &host, const st
hints.ai_protocol = IPPROTO_TCP;

addrinfo *result;
if (getaddrinfo(host.c_str(), port.c_str(), &hints, &result) != 0) {
return Err(utils::format("failed to resolve address: %s", std::strerror(errno)));
/**
* NOTE:
* mac だと mDNSResponder との間の unix domain socket が作られる?
* このソケットは freeaddrinfo を実行しても残る
*/
const int status = getaddrinfo(host.c_str(), port.c_str(), &hints, &result);
if (status != 0) {
return Err(utils::format("failed to resolve address: %s", gai_strerror(status)));
}

return Ok(result);
Expand Down

0 comments on commit a414df3

Please sign in to comment.