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
dded35ae
Commit
dded35ae
authored
Jun 19, 2022
by
Zebediah Figura
Committed by
Alexandre Julliard
Jul 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Test listen() after a failed connect().
parent
d93712fe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
sock.c
dlls/ws2_32/tests/sock.c
+66
-0
No files found.
dlls/ws2_32/tests/sock.c
View file @
dded35ae
...
@@ -3983,6 +3983,7 @@ static void test_select(void)
...
@@ -3983,6 +3983,7 @@ static void test_select(void)
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
),
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
),
.
sin_port
=
255
,
.
sin_port
=
255
,
};
};
SOCKET
client2
,
server2
;
fdWrite
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
fdWrite
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
set_blocking
(
fdWrite
,
FALSE
);
set_blocking
(
fdWrite
,
FALSE
);
...
@@ -4082,6 +4083,65 @@ static void test_select(void)
...
@@ -4082,6 +4083,65 @@ static void test_select(void)
closesocket
(
fdWrite
);
closesocket
(
fdWrite
);
/* Test listening after a failed connection. */
fdWrite
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
set_blocking
(
fdWrite
,
FALSE
);
address
.
sin_family
=
AF_INET
;
address
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
address
.
sin_port
=
0
;
ret
=
bind
(
fdWrite
,
(
struct
sockaddr
*
)
&
address
,
sizeof
(
address
));
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
ret
=
connect
(
fdWrite
,
(
struct
sockaddr
*
)
&
invalid_addr
,
sizeof
(
invalid_addr
));
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"got error %u
\n
"
,
WSAGetLastError
());
FD_ZERO
(
&
exceptfds
);
FD_SET
(
fdWrite
,
&
exceptfds
);
select_timeout
.
tv_sec
=
10
;
ret
=
select
(
0
,
NULL
,
NULL
,
&
exceptfds
,
&
select_timeout
);
ok
(
ret
==
1
,
"expected 1, got %d
\n
"
,
ret
);
len
=
sizeof
(
address
);
ret
=
getsockname
(
fdWrite
,
(
struct
sockaddr
*
)
&
address
,
&
len
);
ok
(
!
ret
,
"got error %lu
\n
"
,
GetLastError
());
/* Linux seems to forbid this. We'd need to replace the underlying fd. */
ret
=
listen
(
fdWrite
,
1
);
todo_wine
ok
(
!
ret
,
"got error %lu
\n
"
,
GetLastError
());
if
(
!
ret
)
{
client2
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
ret
=
connect
(
client2
,
(
struct
sockaddr
*
)
&
address
,
sizeof
(
address
));
ok
(
!
ret
,
"got error %lu
\n
"
,
GetLastError
());
server2
=
accept
(
fdWrite
,
NULL
,
NULL
);
ok
(
server2
!=
INVALID_SOCKET
,
"got %d
\n
"
,
ret
);
closesocket
(
server2
);
closesocket
(
client2
);
}
len
=
sizeof
(
id
);
id
=
0xdeadbeef
;
ret
=
getsockopt
(
fdWrite
,
SOL_SOCKET
,
SO_ERROR
,
(
char
*
)
&
id
,
&
len
);
ok
(
!
ret
,
"getsockopt failed with %d
\n
"
,
WSAGetLastError
());
ok
(
id
==
WSAECONNREFUSED
,
"got error %lu
\n
"
,
id
);
FD_ZERO_ALL
();
FD_SET
(
fdWrite
,
&
readfds
);
FD_SET
(
fdWrite
,
&
writefds
);
FD_SET
(
fdWrite
,
&
exceptfds
);
select_timeout
.
tv_sec
=
0
;
ret
=
select
(
0
,
&
readfds
,
&
writefds
,
&
exceptfds
,
&
select_timeout
);
ok
(
ret
==
1
,
"got %d
\n
"
,
ret
);
ok
(
FD_ISSET
(
fdWrite
,
&
exceptfds
),
"fdWrite socket is not in the set
\n
"
);
closesocket
(
fdWrite
);
/* test polling after a (synchronous) failure */
/* test polling after a (synchronous) failure */
fdWrite
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
fdWrite
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
...
@@ -4090,6 +4150,12 @@ static void test_select(void)
...
@@ -4090,6 +4150,12 @@ static void test_select(void)
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAECONNREFUSED
,
"got error %u
\n
"
,
WSAGetLastError
());
ok
(
WSAGetLastError
()
==
WSAECONNREFUSED
,
"got error %u
\n
"
,
WSAGetLastError
());
len
=
sizeof
(
id
);
id
=
0xdeadbeef
;
ret
=
getsockopt
(
fdWrite
,
SOL_SOCKET
,
SO_ERROR
,
(
char
*
)
&
id
,
&
len
);
ok
(
!
ret
,
"getsockopt failed with %d
\n
"
,
WSAGetLastError
());
todo_wine
ok
(
!
id
,
"got error %lu
\n
"
,
id
);
FD_ZERO_ALL
();
FD_ZERO_ALL
();
FD_SET
(
fdWrite
,
&
readfds
);
FD_SET
(
fdWrite
,
&
readfds
);
FD_SET
(
fdWrite
,
&
writefds
);
FD_SET
(
fdWrite
,
&
writefds
);
...
...
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