Mike Kaplinskiy : server: Fix connect failures on newer kernels.
Alexandre Julliard
julliard at winehq.org
Mon Jan 24 11:07:40 CST 2011
Module: wine
Branch: master
Commit: f58c709b5f82ec6c850a723437933bbc21327da2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f58c709b5f82ec6c850a723437933bbc21327da2
Author: Mike Kaplinskiy <mike.kaplinskiy at gmail.com>
Date: Mon Jan 24 00:21:15 2011 -0500
server: Fix connect failures on newer kernels.
---
dlls/ws2_32/tests/sock.c | 2 +-
server/sock.c | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index df6bff8..9d1de46 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -4026,7 +4026,7 @@ static void test_ConnectEx(void)
closesocket(listener);
listener = INVALID_SOCKET;
- address.sin_port = 1;
+ 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: "
diff --git a/server/sock.c b/server/sock.c
index d37a316..b0efc16 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -388,18 +388,18 @@ static void sock_poll_event( struct fd *fd, int event )
if (sock->state & FD_CONNECT)
{
- /* connecting */
- if (event & POLLOUT)
+ if (event & (POLLERR|POLLHUP))
{
- /* we got connected */
- sock->state |= FD_WINE_CONNECTED|FD_READ|FD_WRITE;
+ /* we didn't get connected? */
sock->state &= ~FD_CONNECT;
+ event &= ~POLLOUT;
+ error = sock_error( fd );
}
- else if (event & (POLLERR|POLLHUP))
+ else if (event & POLLOUT)
{
- /* we didn't get connected? */
+ /* we got connected */
+ sock->state |= FD_WINE_CONNECTED|FD_READ|FD_WRITE;
sock->state &= ~FD_CONNECT;
- error = sock_error( fd );
}
}
else if (sock->state & FD_WINE_LISTENING)
More information about the wine-cvs
mailing list