diff --git a/README.md b/README.md index 2568e276..a7a6482a 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Besides that the following additional changes are included: * Lockfree algorithm for filedescriptor cache (improves file access speed) * Other Pipelight specific enhancements * Reduced SetTimer minimum value from 10 ms to 5 ms (improves Silverlight framerates) +* SO_CONNECT_TIME returns the appropriate time * Support for GetVolumePathName * Workaround for shlwapi URLs with relative paths * XEMBED support for embedding Wine windows inside Linux applications diff --git a/debian/changelog b/debian/changelog index 29611550..dcc91de8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,7 +9,8 @@ wine-compholio (1.7.24) UNRELEASED; urgency=low * Added patch to fix ConnectNamedPort return value in overlapped mode. * Added patch to store IOCS data in a property instead of GWLP_USERDATA. * Added patch to return empty D3D hardware flags for HEL device enumeration. - -- Erich E. Hoover Wed, 30 Jul 2014 17:02:55 -0600 + * Added patch to return the appropriate connection time with SO_CONNECT_TIME. + -- Erich E. Hoover Wed, 30 Jul 2014 17:40:14 -0600 wine-compholio (1.7.23) unstable; urgency=low * Rewrite of patch system to simplify maintaining large patchsets. diff --git a/patches/Makefile b/patches/Makefile index ffcca6ab..a2fda562 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -35,6 +35,7 @@ PATCHLIST := Miscellaneous.ok \ wineboot-HKEY_DYN_DATA.ok \ winepulse-PulseAudio_Support.ok \ winex11-XEMBED.ok \ + ws2_32-Connect_Time.ok \ ws2_32-TransmitFile.ok \ ws2_32-inet_pton.ok \ wtsapi32-EnumerateProcesses.ok @@ -661,6 +662,22 @@ winex11-XEMBED.ok: echo '+ { "winex11-XEMBED", "Sebastian Lackner", "Update gl_drawable for embedded windows." },'; \ ) > winex11-XEMBED.ok +# Patchset ws2_32-Connect_Time +# | +# | Included patches: +# | * Return the appropriate connection time with SO_CONNECT_TIME. [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: + $(PATCH) < ws2_32-Connect_Time/0001-server-Store-the-time-of-the-socket-connection.patch + $(PATCH) < ws2_32-Connect_Time/0002-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." },'; \ + ) > ws2_32-Connect_Time.ok + # Patchset ws2_32-TransmitFile # | # | Included patches: 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 new file mode 100644 index 00000000..78513f64 --- /dev/null +++ b/patches/ws2_32-Connect_Time/0001-server-Store-the-time-of-the-socket-connection.patch @@ -0,0 +1,77 @@ +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/0002-ws2_32-Properly-implement-SO_CONNECT_TIME.patch new file mode 100644 index 00000000..2702c5bf --- /dev/null +++ b/patches/ws2_32-Connect_Time/0002-ws2_32-Properly-implement-SO_CONNECT_TIME.patch @@ -0,0 +1,97 @@ +From b12ee02f7341a4c2d7fc874bd3cba10c7cd452c1 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(-) + +diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c +index 5900c8f..8b63a1e 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) + return status; + } + ++static unsigned int _get_connect_time(SOCKET s) ++{ ++ NTSTATUS status; ++ unsigned int connect_time = 0; ++ 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; ++ } ++ SERVER_END_REQ; ++ return connect_time; ++} ++ + static unsigned int _get_sock_mask(SOCKET s) + { + unsigned int ret; +@@ -3121,22 +3136,19 @@ 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))) + *(DWORD *)optval = ~0u; + else +- { +- if (!pretendtime) FIXME("WS_SO_CONNECT_TIME - faking results\n"); +- *(DWORD *)optval = pretendtime++; +- } ++ *(DWORD *)optval = (GetTickCount() - connect_time) / 1000; + *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 +--- a/dlls/ws2_32/tests/sock.c ++++ b/dlls/ws2_32/tests/sock.c +@@ -4141,6 +4141,8 @@ static void test_send(void) + OVERLAPPED ov; + BOOL bret; + DWORD id, bytes_sent, dwRet; ++ socklen_t optlen; ++ DWORD connect_time; + + memset(&ov, 0, sizeof(ov)); + +@@ -4235,6 +4237,18 @@ static void test_send(void) + ok(ret == SOCKET_ERROR && WSAGetLastError() == ERROR_IO_PENDING, + "Failed to start overlapped send %d - %d\n", ret, WSAGetLastError()); + ++ connect_time = 0; ++ optlen = sizeof(connect_time); ++ ret = getsockopt(dst, SOL_SOCKET, SO_CONNECT_TIME, (char *)&connect_time, &optlen); ++ ok(!ret, "getsockopt failed %d\n", WSAGetLastError()); ++ ok(connect_time > 0, "unexpected connect time %u\n", connect_time); ++ ++ connect_time = 0; ++ optlen = sizeof(connect_time); ++ ret = getsockopt(src, SOL_SOCKET, SO_CONNECT_TIME, (char *)&connect_time, &optlen); ++ ok(!ret, "getsockopt failed %d\n", WSAGetLastError()); ++ ok(connect_time > 0, "unexpected connect time %u\n", connect_time); ++ + end: + if (src != INVALID_SOCKET) + closesocket(src); +-- +1.7.9.5 + diff --git a/patches/ws2_32-Connect_Time/definition b/patches/ws2_32-Connect_Time/definition new file mode 100644 index 00000000..72962d20 --- /dev/null +++ b/patches/ws2_32-Connect_Time/definition @@ -0,0 +1,4 @@ +Author: Bruno Jesus / Erich E. Hoover +Subject: Return the appropriate connection time with SO_CONNECT_TIME. +Revision: 1 +Fixes: SO_CONNECT_TIME returns the appropriate time