Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1c5b19e1
Commit
1c5b19e1
authored
Jun 07, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Jun 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Use IOCTL_WINE_AFD_KEEPALIVE_VALS.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a43c000a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
60 deletions
+17
-60
socket.c
dlls/ws2_32/socket.c
+8
-48
sock.c
dlls/ws2_32/tests/sock.c
+9
-12
No files found.
dlls/ws2_32/socket.c
View file @
1c5b19e1
...
@@ -40,11 +40,6 @@
...
@@ -40,11 +40,6 @@
# define sipx_node sipx_addr.x_host.c_host
# define sipx_node sipx_addr.x_host.c_host
#endif
/* __FreeBSD__ */
#endif
/* __FreeBSD__ */
#if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE)
/* TCP_KEEPALIVE is the Mac OS name for TCP_KEEPIDLE */
#define TCP_KEEPIDLE TCP_KEEPALIVE
#endif
#define FILE_USE_FILE_POINTER_POSITION ((LONGLONG)-2)
#define FILE_USE_FILE_POINTER_POSITION ((LONGLONG)-2)
WINE_DEFAULT_DEBUG_CHANNEL
(
winsock
);
WINE_DEFAULT_DEBUG_CHANNEL
(
winsock
);
...
@@ -3228,7 +3223,6 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
...
@@ -3228,7 +3223,6 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
DWORD
out_size
,
LPDWORD
ret_size
,
LPWSAOVERLAPPED
overlapped
,
DWORD
out_size
,
LPDWORD
ret_size
,
LPWSAOVERLAPPED
overlapped
,
LPWSAOVERLAPPED_COMPLETION_ROUTINE
completion
)
LPWSAOVERLAPPED_COMPLETION_ROUTINE
completion
)
{
{
int
fd
;
DWORD
status
=
0
,
total
=
0
;
DWORD
status
=
0
,
total
=
0
;
TRACE
(
"%04lx, %s, %p, %d, %p, %d, %p, %p, %p
\n
"
,
TRACE
(
"%04lx, %s, %p, %d, %p, %d, %p, %p, %p
\n
"
,
...
@@ -3422,52 +3416,18 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
...
@@ -3422,52 +3416,18 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
SetLastError
(
WSAEINVAL
);
SetLastError
(
WSAEINVAL
);
return
-
1
;
return
-
1
;
}
}
case
WS_SIO_KEEPALIVE_VALS
:
case
WS_SIO_KEEPALIVE_VALS
:
{
{
struct
tcp_keepalive
*
k
;
DWORD
ret
;
int
keepalive
,
keepidle
,
keepintvl
;
if
(
!
in_buff
||
in_size
<
sizeof
(
struct
tcp_keepalive
))
{
SetLastError
(
WSAEFAULT
);
return
SOCKET_ERROR
;
}
k
=
in_buff
;
keepalive
=
k
->
onoff
?
1
:
0
;
keepidle
=
max
(
1
,
(
k
->
keepalivetime
+
500
)
/
1000
);
keepintvl
=
max
(
1
,
(
k
->
keepaliveinterval
+
500
)
/
1000
);
TRACE
(
"onoff: %d, keepalivetime: %d, keepaliveinterval: %d
\n
"
,
keepalive
,
keepidle
,
keepintvl
);
ret
=
server_ioctl_sock
(
s
,
IOCTL_AFD_WINE_KEEPALIVE_VALS
,
in_buff
,
in_size
,
out_buff
,
out_size
,
ret_size
,
overlapped
,
completion
);
if
(
!
overlapped
||
completion
)
*
ret_size
=
0
;
SetLastError
(
ret
);
return
ret
?
-
1
:
0
;
}
fd
=
get_sock_fd
(
s
,
0
,
NULL
);
if
(
setsockopt
(
fd
,
SOL_SOCKET
,
SO_KEEPALIVE
,
(
void
*
)
&
keepalive
,
sizeof
(
int
))
==
-
1
)
status
=
WSAEINVAL
;
#if defined(TCP_KEEPIDLE) || defined(TCP_KEEPINTVL)
/* these values need to be set only if SO_KEEPALIVE is enabled */
else
if
(
keepalive
)
{
#ifndef TCP_KEEPIDLE
FIXME
(
"ignoring keepalive timeout
\n
"
);
#else
if
(
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_KEEPIDLE
,
(
void
*
)
&
keepidle
,
sizeof
(
int
))
==
-
1
)
status
=
WSAEINVAL
;
else
#endif
#ifdef TCP_KEEPINTVL
if
(
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_KEEPINTVL
,
(
void
*
)
&
keepintvl
,
sizeof
(
int
))
==
-
1
)
status
=
WSAEINVAL
;
#else
FIXME
(
"ignoring keepalive interval
\n
"
);
#endif
}
#else
else
FIXME
(
"ignoring keepalive interval and timeout
\n
"
);
#endif
release_sock_fd
(
s
,
fd
);
break
;
}
case
WS_SIO_ROUTING_INTERFACE_QUERY
:
case
WS_SIO_ROUTING_INTERFACE_QUERY
:
{
{
struct
WS_sockaddr
*
daddr
=
(
struct
WS_sockaddr
*
)
in_buff
;
struct
WS_sockaddr
*
daddr
=
(
struct
WS_sockaddr
*
)
in_buff
;
...
...
dlls/ws2_32/tests/sock.c
View file @
1c5b19e1
...
@@ -4012,21 +4012,21 @@ static void test_keepalive_vals(void)
...
@@ -4012,21 +4012,21 @@ static void test_keepalive_vals(void)
ret
=
WSAIoctl
(
sock
,
SIO_KEEPALIVE_VALS
,
&
kalive
,
0
,
NULL
,
0
,
&
size
,
NULL
,
NULL
);
ret
=
WSAIoctl
(
sock
,
SIO_KEEPALIVE_VALS
,
&
kalive
,
0
,
NULL
,
0
,
&
size
,
NULL
,
NULL
);
ok
(
ret
==
SOCKET_ERROR
,
"WSAIoctl succeeded unexpectedly
\n
"
);
ok
(
ret
==
SOCKET_ERROR
,
"WSAIoctl succeeded unexpectedly
\n
"
);
ok
(
WSAGetLastError
()
==
WSAEFAULT
,
"got error %u
\n
"
,
WSAGetLastError
());
ok
(
WSAGetLastError
()
==
WSAEFAULT
,
"got error %u
\n
"
,
WSAGetLastError
());
todo_wine
ok
(
!
size
,
"got size %u
\n
"
,
size
);
ok
(
!
size
,
"got size %u
\n
"
,
size
);
WSASetLastError
(
0xdeadbeef
);
WSASetLastError
(
0xdeadbeef
);
size
=
0xdeadbeef
;
size
=
0xdeadbeef
;
ret
=
WSAIoctl
(
sock
,
SIO_KEEPALIVE_VALS
,
NULL
,
sizeof
(
kalive
),
NULL
,
0
,
&
size
,
NULL
,
NULL
);
ret
=
WSAIoctl
(
sock
,
SIO_KEEPALIVE_VALS
,
NULL
,
sizeof
(
kalive
),
NULL
,
0
,
&
size
,
NULL
,
NULL
);
ok
(
ret
==
SOCKET_ERROR
,
"WSAIoctl succeeded unexpectedly
\n
"
);
ok
(
ret
==
SOCKET_ERROR
,
"WSAIoctl succeeded unexpectedly
\n
"
);
ok
(
WSAGetLastError
()
==
WSAEFAULT
,
"got error %u
\n
"
,
WSAGetLastError
());
ok
(
WSAGetLastError
()
==
WSAEFAULT
,
"got error %u
\n
"
,
WSAGetLastError
());
todo_wine
ok
(
!
size
,
"got size %u
\n
"
,
size
);
ok
(
!
size
,
"got size %u
\n
"
,
size
);
WSASetLastError
(
0xdeadbeef
);
WSASetLastError
(
0xdeadbeef
);
size
=
0xdeadbeef
;
size
=
0xdeadbeef
;
make_keepalive
(
kalive
,
0
,
0
,
0
);
make_keepalive
(
kalive
,
0
,
0
,
0
);
ret
=
WSAIoctl
(
sock
,
SIO_KEEPALIVE_VALS
,
&
kalive
,
sizeof
(
kalive
),
NULL
,
0
,
&
size
,
NULL
,
NULL
);
ret
=
WSAIoctl
(
sock
,
SIO_KEEPALIVE_VALS
,
&
kalive
,
sizeof
(
kalive
),
NULL
,
0
,
&
size
,
NULL
,
NULL
);
ok
(
ret
==
0
,
"WSAIoctl failed unexpectedly
\n
"
);
ok
(
ret
==
0
,
"WSAIoctl failed unexpectedly
\n
"
);
todo_wine
ok
(
!
WSAGetLastError
(),
"got error %u
\n
"
,
WSAGetLastError
());
ok
(
!
WSAGetLastError
(),
"got error %u
\n
"
,
WSAGetLastError
());
ok
(
!
size
,
"got size %u
\n
"
,
size
);
ok
(
!
size
,
"got size %u
\n
"
,
size
);
ret
=
WSAIoctl
(
sock
,
SIO_KEEPALIVE_VALS
,
&
kalive
,
sizeof
(
kalive
),
NULL
,
0
,
NULL
,
NULL
,
NULL
);
ret
=
WSAIoctl
(
sock
,
SIO_KEEPALIVE_VALS
,
&
kalive
,
sizeof
(
kalive
),
NULL
,
0
,
NULL
,
NULL
,
NULL
);
...
@@ -4054,7 +4054,7 @@ static void test_keepalive_vals(void)
...
@@ -4054,7 +4054,7 @@ static void test_keepalive_vals(void)
overlapped
.
InternalHigh
=
0xdeadbeef
;
overlapped
.
InternalHigh
=
0xdeadbeef
;
ret
=
WSAIoctl
(
sock
,
SIO_KEEPALIVE_VALS
,
&
kalive
,
sizeof
(
kalive
),
NULL
,
0
,
&
size
,
&
overlapped
,
NULL
);
ret
=
WSAIoctl
(
sock
,
SIO_KEEPALIVE_VALS
,
&
kalive
,
sizeof
(
kalive
),
NULL
,
0
,
&
size
,
&
overlapped
,
NULL
);
ok
(
ret
==
0
,
"WSAIoctl failed unexpectedly
\n
"
);
ok
(
ret
==
0
,
"WSAIoctl failed unexpectedly
\n
"
);
todo_wine
ok
(
!
WSAGetLastError
(),
"got error %u
\n
"
,
WSAGetLastError
());
ok
(
!
WSAGetLastError
(),
"got error %u
\n
"
,
WSAGetLastError
());
todo_wine
ok
(
size
==
0xdeadbeef
,
"got size %u
\n
"
,
size
);
todo_wine
ok
(
size
==
0xdeadbeef
,
"got size %u
\n
"
,
size
);
ret
=
GetQueuedCompletionStatus
(
port
,
&
size
,
&
key
,
&
overlapped_ptr
,
0
);
ret
=
GetQueuedCompletionStatus
(
port
,
&
size
,
&
key
,
&
overlapped_ptr
,
0
);
...
@@ -4100,14 +4100,11 @@ static void test_keepalive_vals(void)
...
@@ -4100,14 +4100,11 @@ static void test_keepalive_vals(void)
ok
(
!
size
,
"got size %u
\n
"
,
size
);
ok
(
!
size
,
"got size %u
\n
"
,
size
);
ret
=
SleepEx
(
0
,
TRUE
);
ret
=
SleepEx
(
0
,
TRUE
);
todo_wine
ok
(
ret
==
WAIT_IO_COMPLETION
,
"got %d
\n
"
,
ret
);
ok
(
ret
==
WAIT_IO_COMPLETION
,
"got %d
\n
"
,
ret
);
if
(
ret
==
WAIT_IO_COMPLETION
)
ok
(
apc_count
==
1
,
"APC was called %u times
\n
"
,
apc_count
);
{
ok
(
!
apc_error
,
"got APC error %u
\n
"
,
apc_error
);
ok
(
apc_count
==
1
,
"APC was called %u times
\n
"
,
apc_count
);
ok
(
!
apc_size
,
"got APC size %u
\n
"
,
apc_size
);
ok
(
!
apc_error
,
"got APC error %u
\n
"
,
apc_error
);
ok
(
apc_overlapped
==
&
overlapped
,
"got APC overlapped %p
\n
"
,
apc_overlapped
);
ok
(
!
apc_size
,
"got APC size %u
\n
"
,
apc_size
);
ok
(
apc_overlapped
==
&
overlapped
,
"got APC overlapped %p
\n
"
,
apc_overlapped
);
}
closesocket
(
sock
);
closesocket
(
sock
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment