mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 19:49:50 +00:00
ws2_32: Don't return synchronously if the connection is refused.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
448ac0e9c4
commit
2910dcea89
2 changed files with 13 additions and 15 deletions
|
@ -3586,7 +3586,13 @@ static BOOL WINAPI WS2_ConnectEx(SOCKET s, const struct WS_sockaddr* name, int n
|
|||
|
||||
/* If the connect already failed */
|
||||
if (status == STATUS_PIPE_DISCONNECTED)
|
||||
status = _get_sock_error(s, FD_CONNECT_BIT);
|
||||
{
|
||||
ov->Internal = _get_sock_error(s, FD_CONNECT_BIT);
|
||||
ov->InternalHigh = 0;
|
||||
if (cvalue) WS_AddCompletion( s, cvalue, ov->Internal, ov->InternalHigh );
|
||||
if (ov->hEvent) NtSetEvent( ov->hEvent, NULL );
|
||||
status = STATUS_PENDING;
|
||||
}
|
||||
SetLastError( NtStatusToWSAError(status) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7915,22 +7915,14 @@ static void test_ConnectEx(void)
|
|||
address.sin_port = htons(1);
|
||||
|
||||
bret = pConnectEx(connector, (struct sockaddr*)&address, addrlen, NULL, 0, &bytesReturned, &overlapped);
|
||||
ok(bret == FALSE && GetLastError(), "ConnectEx to bad destination failed: "
|
||||
ok(bret == FALSE && GetLastError() == ERROR_IO_PENDING, "ConnectEx to bad destination failed: "
|
||||
"returned %d + errno %d\n", bret, GetLastError());
|
||||
dwret = WaitForSingleObject(overlapped.hEvent, 15000);
|
||||
ok(dwret == WAIT_OBJECT_0, "Waiting for connect event failed with %d + errno %d\n", dwret, GetLastError());
|
||||
|
||||
if (GetLastError() == ERROR_IO_PENDING)
|
||||
{
|
||||
dwret = WaitForSingleObject(overlapped.hEvent, 15000);
|
||||
ok(dwret == WAIT_OBJECT_0, "Waiting for connect event failed with %d + errno %d\n", dwret, GetLastError());
|
||||
|
||||
bret = GetOverlappedResult((HANDLE)connector, &overlapped, &bytesReturned, FALSE);
|
||||
ok(bret == FALSE && GetLastError() == ERROR_CONNECTION_REFUSED,
|
||||
"Connecting to a disconnected host returned error %d - %d\n", bret, WSAGetLastError());
|
||||
}
|
||||
else {
|
||||
ok(GetLastError() == WSAECONNREFUSED,
|
||||
"Connecting to a disconnected host returned error %d - %d\n", bret, WSAGetLastError());
|
||||
}
|
||||
bret = GetOverlappedResult((HANDLE)connector, &overlapped, &bytesReturned, FALSE);
|
||||
ok(bret == FALSE && GetLastError() == ERROR_CONNECTION_REFUSED,
|
||||
"Connecting to a disconnected host returned error %d - %d\n", bret, WSAGetLastError());
|
||||
|
||||
end:
|
||||
if (overlapped.hEvent)
|
||||
|
|
Loading…
Reference in a new issue