Commit 68d4643a authored by David Curtiss's avatar David Curtiss Committed by Alexandre Julliard

ws2_32: Allow getsockname after AcceptEx.

.NET 6's HTTP/Socket code queries this. Winsock allows getsockname on the AcceptEx AcceptSocket, but only if SO_UPDATE_ACCEPT_CONTEXT is set. Signed-off-by: 's avatarDavid Curtiss <david.curtiss@ni.com>
parent 26ab7010
......@@ -8143,6 +8143,15 @@ static void test_AcceptEx(void)
ok(bret, "GetOverlappedResult failed, error %ld\n", GetLastError());
ok(bytesReturned == 0, "bytesReturned isn't supposed to be %ld\n", bytesReturned);
/* Try to call getsockname on the acceptor socket.
*
* On Windows, this requires setting SO_UPDATE_ACCEPT_CONTEXT. */
iret = setsockopt(acceptor, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char *)&listener, sizeof(SOCKET));
ok(!iret, "Failed to set accept context %ld\n", GetLastError());
iret = getsockname(acceptor, (struct sockaddr *)&peerAddress, &remoteSize);
ok(!iret, "getsockname failed.\n");
ok(remoteSize == sizeof(struct sockaddr_in), "got remote size %u\n", remoteSize);
closesocket(connector);
connector = INVALID_SOCKET;
closesocket(acceptor);
......
......@@ -1846,6 +1846,7 @@ static int accept_into_socket( struct sock *sock, struct sock *acceptsock )
}
acceptsock->state = SOCK_CONNECTED;
acceptsock->bound = 1;
acceptsock->pending_events = 0;
acceptsock->reported_events = 0;
acceptsock->proto = sock->proto;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment