Skip to content

Commit

Permalink
Fix "no error" reported in log when error occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
lanthora committed Mar 8, 2024
1 parent 972ac48 commit 8422e3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions ixwebsocket/IXDNSLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace ix
DNSLookup::AddrInfoPtr DNSLookup::resolveUnCancellable(
std::string& errMsg, const CancellationRequest& isCancellationRequested)
{
errMsg = "no error";
errMsg = "unknown error";

// Maybe a cancellation request got in before the background thread terminated ?
if (isCancellationRequested())
Expand All @@ -97,12 +97,13 @@ namespace ix
DNSLookup::AddrInfoPtr DNSLookup::resolveCancellable(
std::string& errMsg, const CancellationRequest& isCancellationRequested)
{
errMsg = "no error";
errMsg = "unknown error";

// Can only be called once, otherwise we would have to manage a pool
// of background thread which is overkill for our usage.
if (_done)
{
errMsg = "programming error";
return nullptr; // programming error, create a second DNSLookup instance
// if you need a second lookup.
}
Expand Down Expand Up @@ -156,7 +157,7 @@ namespace ix
// We don't want to read or write into members variables of an object that could be
// gone, so we use temporary variables (res) or we pass in by copy everything that
// getAddrInfo needs to work.
std::string errMsg;
std::string errMsg = "unknown error";
auto res = getAddrInfo(hostname, port, errMsg);

if (auto lock = self.lock())
Expand Down
2 changes: 1 addition & 1 deletion ixwebsocket/IXSocketConnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace ix
std::string& errMsg,
const CancellationRequest& isCancellationRequested)
{
errMsg = "no error";
errMsg = "unknown error";

socket_t fd = socket(address->ai_family, address->ai_socktype, address->ai_protocol);
if (fd < 0)
Expand Down

0 comments on commit 8422e3a

Please sign in to comment.