From ed7e1530b5cb8f6f9504f22337c8d58a31de3c76 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 12 Nov 2014 17:59:01 +0100 Subject: [PATCH] Rebase patches for WS_SO_CONNECT_TIME. --- debian/changelog | 1 + patches/Makefile | 7 +- ...re-the-time-of-the-socket-connection.patch | 77 ------------------- ...-Properly-implement-SO_CONNECT_TIME.patch} | 66 ++++++++++------ patches/ws2_32-Connect_Time/definition | 2 +- 5 files changed, 48 insertions(+), 105 deletions(-) delete mode 100644 patches/ws2_32-Connect_Time/0001-server-Store-the-time-of-the-socket-connection.patch rename patches/ws2_32-Connect_Time/{0002-ws2_32-Properly-implement-SO_CONNECT_TIME.patch => 0001-ws2_32-Properly-implement-SO_CONNECT_TIME.patch} (55%) diff --git a/debian/changelog b/debian/changelog index 64d63319..27cd4573 100644 --- a/debian/changelog +++ b/debian/changelog @@ -30,6 +30,7 @@ wine-compholio (1.7.31) UNRELEASED; urgency=low * Removed patch with additional tests for MsgWaitForMultipleObjectsEx (accepted upstream). * Removed patches for D3DXCreatePolygon (accepted upstream). * Partially removed patches for UTF-7 tests (accepted upstream). + * Partially removed patches for WS_SO_CONNECT_TIME (accepted upstream). -- Sebastian Lackner Mon, 03 Nov 2014 20:10:04 +0100 wine-compholio (1.7.30) unstable; urgency=low diff --git a/patches/Makefile b/patches/Makefile index 06d003f3..5c051510 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -2047,17 +2047,16 @@ wpcap-Dynamic_Linking.ok: # Patchset ws2_32-Connect_Time # | # | Included patches: -# | * Return the appropriate connection time with SO_CONNECT_TIME. [by Bruno Jesus / Erich E. Hoover] +# | * Return the appropriate connection time with SO_CONNECT_TIME. [rev 2, by Bruno Jesus / Erich E. Hoover] # | # | Modified files: # | * dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c, server/protocol.def, server/sock.c # | .INTERMEDIATE: ws2_32-Connect_Time.ok ws2_32-Connect_Time.ok: - $(call APPLY_FILE,ws2_32-Connect_Time/0001-server-Store-the-time-of-the-socket-connection.patch) - $(call APPLY_FILE,ws2_32-Connect_Time/0002-ws2_32-Properly-implement-SO_CONNECT_TIME.patch) + $(call APPLY_FILE,ws2_32-Connect_Time/0001-ws2_32-Properly-implement-SO_CONNECT_TIME.patch) @( \ - echo '+ { "ws2_32-Connect_Time", "Bruno Jesus / Erich E. Hoover", "Return the appropriate connection time with SO_CONNECT_TIME." },'; \ + echo '+ { "ws2_32-Connect_Time", "Bruno Jesus / Erich E. Hoover", "Return the appropriate connection time with SO_CONNECT_TIME. [rev 2]" },'; \ ) > ws2_32-Connect_Time.ok # Patchset ws2_32-TransmitFile diff --git a/patches/ws2_32-Connect_Time/0001-server-Store-the-time-of-the-socket-connection.patch b/patches/ws2_32-Connect_Time/0001-server-Store-the-time-of-the-socket-connection.patch deleted file mode 100644 index 78513f64..00000000 --- a/patches/ws2_32-Connect_Time/0001-server-Store-the-time-of-the-socket-connection.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 2f3b06f07833241df4123f87accbfe4f35865f7c Mon Sep 17 00:00:00 2001 -From: Bruno Jesus <00cpxxx@gmail.com> -Date: Wed, 30 Jul 2014 17:34:20 -0600 -Subject: server: Store the time of the socket connection. - ---- - server/protocol.def | 1 + - server/sock.c | 6 ++++++ - 2 files changed, 7 insertions(+) - -diff --git a/server/protocol.def b/server/protocol.def -index a8c1fb9..390d5a8 100644 ---- a/server/protocol.def -+++ b/server/protocol.def -@@ -1238,6 +1238,7 @@ enum server_fd_type - int family; /* family, see socket manpage */ - int type; /* type, see socket manpage */ - int protocol; /* protocol, see socket manpage */ -+ unsigned int connect_time; /* time the socket was connected (tick count) */ - @END - - -diff --git a/server/sock.c b/server/sock.c -index 4adad0f..565b4c9 100644 ---- a/server/sock.c -+++ b/server/sock.c -@@ -107,6 +107,7 @@ struct sock - unsigned int message; /* message to send */ - obj_handle_t wparam; /* message wparam (socket handle) */ - int errors[FD_MAX_EVENTS]; /* event errors */ -+ unsigned int connect_time;/* time the socket was connected (tick count) */ - struct sock *deferred; /* socket that waits for a deferred accept */ - struct async_queue *read_q; /* queue for asynchronous reads */ - struct async_queue *write_q; /* queue for asynchronous writes */ -@@ -401,6 +402,7 @@ static void sock_poll_event( struct fd *fd, int event ) - /* we got connected */ - sock->state |= FD_WINE_CONNECTED|FD_READ|FD_WRITE; - sock->state &= ~FD_CONNECT; -+ sock->connect_time = get_tick_count(); - } - } - else if (sock->state & FD_WINE_LISTENING) -@@ -618,6 +620,7 @@ static void init_sock(struct sock *sock) - sock->window = 0; - sock->message = 0; - sock->wparam = 0; -+ sock->connect_time = 0; - sock->deferred = NULL; - sock->read_q = NULL; - sock->write_q = NULL; -@@ -725,6 +728,7 @@ static struct sock *accept_socket( obj_handle_t handle ) - acceptsock->family = sock->family; - acceptsock->window = sock->window; - acceptsock->message = sock->message; -+ acceptsock->connect_time = get_tick_count(); - if (sock->event) acceptsock->event = (struct event *)grab_object( sock->event ); - acceptsock->flags = sock->flags; - if (!(acceptsock->fd = create_anonymous_fd( &sock_fd_ops, acceptfd, &acceptsock->obj, -@@ -776,6 +780,7 @@ static int accept_into_socket( struct sock *sock, struct sock *acceptsock ) - acceptsock->type = sock->type; - acceptsock->family = sock->family; - acceptsock->wparam = 0; -+ acceptsock->connect_time = get_tick_count(); - acceptsock->deferred = NULL; - release_object( acceptsock->fd ); - acceptsock->fd = newfd; -@@ -1087,6 +1092,7 @@ DECL_HANDLER(get_socket_info) - reply->family = sock->family; - reply->type = sock->type; - reply->protocol = sock->proto; -+ reply->connect_time = sock->connect_time; - - release_object( &sock->obj ); - } --- -1.7.9.5 - diff --git a/patches/ws2_32-Connect_Time/0002-ws2_32-Properly-implement-SO_CONNECT_TIME.patch b/patches/ws2_32-Connect_Time/0001-ws2_32-Properly-implement-SO_CONNECT_TIME.patch similarity index 55% rename from patches/ws2_32-Connect_Time/0002-ws2_32-Properly-implement-SO_CONNECT_TIME.patch rename to patches/ws2_32-Connect_Time/0001-ws2_32-Properly-implement-SO_CONNECT_TIME.patch index 2702c5bf..4c71b63f 100644 --- a/patches/ws2_32-Connect_Time/0002-ws2_32-Properly-implement-SO_CONNECT_TIME.patch +++ b/patches/ws2_32-Connect_Time/0001-ws2_32-Properly-implement-SO_CONNECT_TIME.patch @@ -1,31 +1,33 @@ -From b12ee02f7341a4c2d7fc874bd3cba10c7cd452c1 Mon Sep 17 00:00:00 2001 +From 89130c6066b4ee8ee478d33fca9fce79baea174a Mon Sep 17 00:00:00 2001 From: Bruno Jesus <00cpxxx@gmail.com> Date: Wed, 30 Jul 2014 17:35:13 -0600 Subject: ws2_32: Properly implement SO_CONNECT_TIME. --- - dlls/ws2_32/socket.c | 24 ++++++++++++++++++------ - dlls/ws2_32/tests/sock.c | 14 ++++++++++++++ - 2 files changed, 32 insertions(+), 6 deletions(-) + dlls/ws2_32/socket.c | 21 ++++++++++++++++----- + dlls/ws2_32/tests/sock.c | 14 ++++++++++++++ + server/protocol.def | 1 + + server/sock.c | 1 + + 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index 5900c8f..8b63a1e 100644 +index b3db306..ac6d831 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c -@@ -877,6 +877,21 @@ static NTSTATUS _is_blocking(SOCKET s, BOOL *ret) +@@ -881,6 +881,21 @@ static NTSTATUS _is_blocking(SOCKET s, BOOL *ret) return status; } -+static unsigned int _get_connect_time(SOCKET s) ++static DWORD _get_connect_time(SOCKET s) +{ + NTSTATUS status; -+ unsigned int connect_time = 0; ++ DWORD connect_time = ~0u; + SERVER_START_REQ( get_socket_info ) + { + req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) ); + status = wine_server_call( req ); + if (!status) -+ connect_time = reply->connect_time; ++ connect_time = reply->connect_time / -10000000; + } + SERVER_END_REQ; + return connect_time; @@ -34,37 +36,31 @@ index 5900c8f..8b63a1e 100644 static unsigned int _get_sock_mask(SOCKET s) { unsigned int ret; -@@ -3121,22 +3136,19 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, +@@ -3125,7 +3140,6 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, case WS_SO_CONNECT_TIME: { - static int pretendtime = 0; struct WS_sockaddr addr; int len = sizeof(addr); -+ DWORD connect_time; - if (!optlen || *optlen < sizeof(DWORD) || !optval) - { - SetLastError(WSAEFAULT); - return SOCKET_ERROR; - } -- if (WS_getpeername(s, &addr, &len) == SOCKET_ERROR) -+ if (WS_getpeername(s, &addr, &len) == SOCKET_ERROR || !(connect_time = _get_connect_time(s))) +@@ -3137,10 +3151,7 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, + if (WS_getpeername(s, &addr, &len) == SOCKET_ERROR) *(DWORD *)optval = ~0u; else - { - if (!pretendtime) FIXME("WS_SO_CONNECT_TIME - faking results\n"); - *(DWORD *)optval = pretendtime++; - } -+ *(DWORD *)optval = (GetTickCount() - connect_time) / 1000; ++ *(DWORD *)optval = _get_connect_time(s); *optlen = sizeof(DWORD); return ret; } diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c -index 8a9cbba..7a4ceac 100644 +index 0c39545..2c065a8 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c -@@ -4141,6 +4141,8 @@ static void test_send(void) +@@ -4254,6 +4254,8 @@ static void test_send(void) OVERLAPPED ov; BOOL bret; DWORD id, bytes_sent, dwRet; @@ -73,7 +69,7 @@ index 8a9cbba..7a4ceac 100644 memset(&ov, 0, sizeof(ov)); -@@ -4235,6 +4237,18 @@ static void test_send(void) +@@ -4348,6 +4350,18 @@ static void test_send(void) ok(ret == SOCKET_ERROR && WSAGetLastError() == ERROR_IO_PENDING, "Failed to start overlapped send %d - %d\n", ret, WSAGetLastError()); @@ -92,6 +88,30 @@ index 8a9cbba..7a4ceac 100644 end: if (src != INVALID_SOCKET) closesocket(src); +diff --git a/server/protocol.def b/server/protocol.def +index fc6bec5..840ba0d 100644 +--- a/server/protocol.def ++++ b/server/protocol.def +@@ -1238,6 +1238,7 @@ enum server_fd_type + int family; /* family, see socket manpage */ + int type; /* type, see socket manpage */ + int protocol; /* protocol, see socket manpage */ ++ timeout_t connect_time; /* time the socket was connected (relative) */ + @END + + +diff --git a/server/sock.c b/server/sock.c +index 7c0212e..7416eec 100644 +--- a/server/sock.c ++++ b/server/sock.c +@@ -1093,6 +1093,7 @@ DECL_HANDLER(get_socket_info) + reply->family = sock->family; + reply->type = sock->type; + reply->protocol = sock->proto; ++ reply->connect_time = -(current_time - sock->connect_time); + + release_object( &sock->obj ); + } -- -1.7.9.5 +2.1.3 diff --git a/patches/ws2_32-Connect_Time/definition b/patches/ws2_32-Connect_Time/definition index 72962d20..084878bb 100644 --- a/patches/ws2_32-Connect_Time/definition +++ b/patches/ws2_32-Connect_Time/definition @@ -1,4 +1,4 @@ Author: Bruno Jesus / Erich E. Hoover Subject: Return the appropriate connection time with SO_CONNECT_TIME. -Revision: 1 +Revision: 2 Fixes: SO_CONNECT_TIME returns the appropriate time