Skip to content

Commit

Permalink
Revert "Quickfix: getaddrinfo always returns -3009 - this has been th…
Browse files Browse the repository at this point in the history
…e case for the previous code version too but has been ignored."

This reverts commit 5204ec4.
  • Loading branch information
aentinger committed Jul 17, 2024
1 parent e2dddb1 commit e203e51
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/arch/posix/mbed_tcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,24 @@ int mbed_addrinfo(const char* hostname, const char* portstr, struct addrinfo* hi
mbed_hints.set_ip_address(Ethernet.localIP().toString().c_str());
SocketAddress * mbed_res;

// /* rc either holds the number of results uncovered or a negative error code. */
// auto rc = NetworkInterface::get_default_instance()->getaddrinfo(hostname, &mbed_hints, &mbed_res);
// if (rc < 0)
// {
// UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "NetworkInterface::get_default_instance()->getaddrinfo(...) failed with %d", rc);
// return UA_STATUSCODE_BAD;
// }
//
// int const addr_cnt = rc;
// if (addr_cnt == 0)
// {
// UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "NetworkInterface::get_default_instance()->getaddrinfo(...) found no addresses");
// return UA_STATUSCODE_BAD;
// }
/* rc either holds the number of results uncovered or a negative error code. */
auto rc = NetworkInterface::get_default_instance()->getaddrinfo(hostname, &mbed_hints, &mbed_res);
if (rc < 0)
{
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "NetworkInterface::get_default_instance()->getaddrinfo(...) failed with %d", rc);
return UA_STATUSCODE_BAD;
}

int const addr_cnt = rc;
if (addr_cnt == 0)
{
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "NetworkInterface::get_default_instance()->getaddrinfo(...) found no addresses");
return UA_STATUSCODE_BAD;
}

/* Note: we currently support only a single address result. */
static struct sockaddr ai_addr;
//ai_addr.ai = mbed_res[0];
ai_addr.ai = mbed_hints;
ai_addr.ai = mbed_res[0];

static struct addrinfo res;
memcpy(&res, hints, sizeof(struct addrinfo));
Expand Down

0 comments on commit e203e51

Please sign in to comment.