Skip to content

Commit

Permalink
Revert "NameResolutionPal.Unix: fixed loss of address family informat…
Browse files Browse the repository at this point in the history
…ion in async lookup (dotnet#47171)"

This reverts commit 2f25931.
  • Loading branch information
gfoidl committed Feb 23, 2021
1 parent 8a3fd5a commit e1098f8
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions src/libraries/Native/Unix/System.Native/pal_networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,12 @@ int32_t SystemNative_GetHostEntryForNameAsync(const uint8_t* address, int32_t ad
return GetAddrInfoErrorFlags_EAI_BADARG;
}

sa_family_t platformFamily;
if (!TryConvertAddressFamilyPalToPlatform(addressFamily, &platformFamily))
{
return GetAddrInfoErrorFlags_EAI_FAMILY;
}

struct GetAddrInfoAsyncState* state = malloc(sizeof(*state) + addrlen + 1);

if (state == NULL)
Expand All @@ -616,22 +622,24 @@ int32_t SystemNative_GetHostEntryForNameAsync(const uint8_t* address, int32_t ad

memcpy(state->address, address, addrlen + 1);

state->gai_request = (struct gaicb) {
.ar_name = state->address,
.ar_service = NULL,
.ar_request = &state->hint,
.ar_result = NULL
};
state->gai_requests = &state->gai_request;
state->sigevent = (struct sigevent) {
.sigev_notify = SIGEV_THREAD,
.sigev_value = {
.sival_ptr = state
*state = (struct GetAddrInfoAsyncState) {
.gai_request = {
.ar_name = state->address,
.ar_service = NULL,
.ar_request = &state->hint,
.ar_result = NULL
},
.gai_requests = &state->gai_request,
.sigevent = {
.sigev_notify = SIGEV_THREAD,
.sigev_value = {
.sival_ptr = state
},
.sigev_notify_function = GetHostEntryForNameAsyncComplete
},
.sigev_notify_function = GetHostEntryForNameAsyncComplete
.entry = entry,
.callback = callback
};
state->entry = entry;
state->callback = callback;

atomic_thread_fence(memory_order_release);

Expand Down

0 comments on commit e1098f8

Please sign in to comment.