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
56e58cbe
Commit
56e58cbe
authored
Sep 21, 2023
by
Ally Sommers
Committed by
Alexandre Julliard
Sep 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add more tests for SO_REUSEADDR.
parent
e7824f10
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
101 additions
and
1 deletion
+101
-1
sock.c
dlls/ws2_32/tests/sock.c
+101
-1
No files found.
dlls/ws2_32/tests/sock.c
View file @
56e58cbe
...
...
@@ -2206,7 +2206,7 @@ static void test_reuseaddr(void)
unsigned
int
rc
,
reuse
,
value
;
struct
sockaddr_storage
saddr
;
SOCKET
s1
,
s2
,
s3
,
s4
;
SOCKET
s1
,
s2
,
s3
,
s4
,
s5
,
s6
;
unsigned
int
i
,
j
;
int
size
;
...
...
@@ -2397,6 +2397,106 @@ static void test_reuseaddr(void)
closesocket
(
s1
);
closesocket
(
s2
);
/* Test successive binds and bind-after-listen */
reuse
=
1
;
s1
=
socket
(
tests
[
i
].
domain
,
SOCK_STREAM
,
0
);
ok
(
s1
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
setsockopt
(
s1
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
reuse
,
sizeof
(
reuse
));
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
s2
=
socket
(
tests
[
i
].
domain
,
SOCK_STREAM
,
0
);
ok
(
s2
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
setsockopt
(
s2
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
reuse
,
sizeof
(
reuse
));
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
s3
=
socket
(
tests
[
i
].
domain
,
SOCK_STREAM
,
0
);
ok
(
s3
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
setsockopt
(
s3
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
reuse
,
sizeof
(
reuse
));
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
s4
=
socket
(
tests
[
i
].
domain
,
SOCK_STREAM
,
0
);
ok
(
s4
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
setsockopt
(
s4
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
reuse
,
sizeof
(
reuse
));
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
bind
(
s1
,
tests
[
i
].
addr_loopback
,
tests
[
i
].
addrlen
);
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
bind
(
s2
,
tests
[
i
].
addr_loopback
,
tests
[
i
].
addrlen
);
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
s5
=
socket
(
tests
[
i
].
domain
,
SOCK_STREAM
,
0
);
ok
(
s5
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
listen
(
s1
,
1
);
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
listen
(
s2
,
1
);
todo_wine
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
connect
(
s5
,
tests
[
i
].
addr_loopback
,
tests
[
i
].
addrlen
);
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
/* The connection is delivered to the first socket. */
size
=
tests
[
i
].
addrlen
;
s6
=
accept
(
s1
,
(
struct
sockaddr
*
)
&
saddr
,
&
size
);
ok
(
s6
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
closesocket
(
s1
);
closesocket
(
s5
);
closesocket
(
s6
);
rc
=
bind
(
s3
,
tests
[
i
].
addr_loopback
,
tests
[
i
].
addrlen
);
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
s5
=
socket
(
tests
[
i
].
domain
,
SOCK_STREAM
,
0
);
ok
(
s5
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
connect
(
s5
,
tests
[
i
].
addr_loopback
,
tests
[
i
].
addrlen
);
todo_wine
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
/* The connection is delivered to the second socket. */
size
=
tests
[
i
].
addrlen
;
s6
=
accept
(
s2
,
(
struct
sockaddr
*
)
&
saddr
,
&
size
);
todo_wine
ok
(
s6
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
closesocket
(
s2
);
closesocket
(
s5
);
closesocket
(
s6
);
rc
=
bind
(
s4
,
tests
[
i
].
addr_loopback
,
tests
[
i
].
addrlen
);
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
listen
(
s3
,
1
);
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
s5
=
socket
(
tests
[
i
].
domain
,
SOCK_STREAM
,
0
);
ok
(
s5
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
connect
(
s5
,
tests
[
i
].
addr_loopback
,
tests
[
i
].
addrlen
);
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
/* The connection is delivered to the third socket. */
size
=
tests
[
i
].
addrlen
;
s6
=
accept
(
s3
,
(
struct
sockaddr
*
)
&
saddr
,
&
size
);
ok
(
s6
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
closesocket
(
s3
);
closesocket
(
s5
);
closesocket
(
s6
);
rc
=
listen
(
s4
,
1
);
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
s5
=
socket
(
tests
[
i
].
domain
,
SOCK_STREAM
,
0
);
ok
(
s5
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
rc
=
connect
(
s5
,
tests
[
i
].
addr_loopback
,
tests
[
i
].
addrlen
);
ok
(
!
rc
,
"got error %d.
\n
"
,
WSAGetLastError
());
/* The connection is delivered to the fourth socket. */
size
=
tests
[
i
].
addrlen
;
s6
=
accept
(
s4
,
(
struct
sockaddr
*
)
&
saddr
,
&
size
);
ok
(
s6
!=
INVALID_SOCKET
,
"got error %d.
\n
"
,
WSAGetLastError
());
closesocket
(
s4
);
closesocket
(
s5
);
closesocket
(
s6
);
winetest_pop_context
();
}
...
...
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