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
1e0b65f3
Commit
1e0b65f3
authored
Apr 30, 2012
by
Erich Hoover
Committed by
Alexandre Julliard
May 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: AcceptEx IOCP initialization cleanup.
parent
ab509cde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
132 deletions
+61
-132
sock.c
dlls/ws2_32/tests/sock.c
+61
-132
No files found.
dlls/ws2_32/tests/sock.c
View file @
1e0b65f3
...
@@ -5274,6 +5274,58 @@ static void test_WSAAsyncGetServByName(void)
...
@@ -5274,6 +5274,58 @@ static void test_WSAAsyncGetServByName(void)
DestroyWindow
(
hwnd
);
DestroyWindow
(
hwnd
);
}
}
/*
* Provide consistent initialization for the AcceptEx IOCP tests.
*/
static
SOCKET
setup_iocp_src
(
struct
sockaddr_in
*
bindAddress
)
{
SOCKET
src
,
ret
=
INVALID_SOCKET
;
int
iret
,
socklen
;
src
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
src
==
INVALID_SOCKET
)
{
skip
(
"could not create listener socket, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
memset
(
bindAddress
,
0
,
sizeof
(
*
bindAddress
));
bindAddress
->
sin_family
=
AF_INET
;
bindAddress
->
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
iret
=
bind
(
src
,
(
struct
sockaddr
*
)
bindAddress
,
sizeof
(
*
bindAddress
));
if
(
iret
!=
0
)
{
skip
(
"failed to bind, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
socklen
=
sizeof
(
*
bindAddress
);
iret
=
getsockname
(
src
,
(
struct
sockaddr
*
)
bindAddress
,
&
socklen
);
if
(
iret
!=
0
)
{
skip
(
"failed to lookup bind address, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
if
(
set_blocking
(
src
,
FALSE
))
{
skip
(
"couldn't make socket non-blocking, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
iret
=
listen
(
src
,
5
);
if
(
iret
!=
0
)
{
skip
(
"listening failed, errno = %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
ret
=
src
;
end:
if
(
src
!=
ret
&&
ret
==
INVALID_SOCKET
)
closesocket
(
src
);
return
ret
;
}
static
void
test_completion_port
(
void
)
static
void
test_completion_port
(
void
)
{
{
HANDLE
previous_port
,
io_port
;
HANDLE
previous_port
,
io_port
;
...
@@ -5289,7 +5341,6 @@ static void test_completion_port(void)
...
@@ -5289,7 +5341,6 @@ static void test_completion_port(void)
struct
sockaddr_in
bindAddress
;
struct
sockaddr_in
bindAddress
;
GUID
acceptExGuid
=
WSAID_ACCEPTEX
;
GUID
acceptExGuid
=
WSAID_ACCEPTEX
;
LPFN_ACCEPTEX
pAcceptEx
=
NULL
;
LPFN_ACCEPTEX
pAcceptEx
=
NULL
;
int
socklen
;
previous_port
=
CreateIoCompletionPort
(
INVALID_HANDLE_VALUE
,
NULL
,
0
,
0
);
previous_port
=
CreateIoCompletionPort
(
INVALID_HANDLE_VALUE
,
NULL
,
0
,
0
);
ok
(
previous_port
!=
NULL
,
"Failed to create completion port %u
\n
"
,
GetLastError
());
ok
(
previous_port
!=
NULL
,
"Failed to create completion port %u
\n
"
,
GetLastError
());
...
@@ -5401,14 +5452,6 @@ static void test_completion_port(void)
...
@@ -5401,14 +5452,6 @@ static void test_completion_port(void)
if
(
dest
!=
INVALID_SOCKET
)
if
(
dest
!=
INVALID_SOCKET
)
closesocket
(
dest
);
closesocket
(
dest
);
src
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
src
==
INVALID_SOCKET
)
{
skip
(
"could not create listener socket, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
dest
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
dest
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
dest
==
INVALID_SOCKET
)
if
(
dest
==
INVALID_SOCKET
)
{
{
...
@@ -5416,7 +5459,7 @@ static void test_completion_port(void)
...
@@ -5416,7 +5459,7 @@ static void test_completion_port(void)
goto
end
;
goto
end
;
}
}
iret
=
WSAIoctl
(
src
,
SIO_GET_EXTENSION_FUNCTION_POINTER
,
&
acceptExGuid
,
sizeof
(
acceptExGuid
),
iret
=
WSAIoctl
(
dest
,
SIO_GET_EXTENSION_FUNCTION_POINTER
,
&
acceptExGuid
,
sizeof
(
acceptExGuid
),
&
pAcceptEx
,
sizeof
(
pAcceptEx
),
&
num_bytes
,
NULL
,
NULL
);
&
pAcceptEx
,
sizeof
(
pAcceptEx
),
&
num_bytes
,
NULL
,
NULL
);
if
(
iret
)
if
(
iret
)
{
{
...
@@ -5424,28 +5467,10 @@ static void test_completion_port(void)
...
@@ -5424,28 +5467,10 @@ static void test_completion_port(void)
goto
end
;
goto
end
;
}
}
memset
(
&
bindAddress
,
0
,
sizeof
(
bindAddress
));
/* Test IOCP response on socket close (IOCP created after AcceptEx) */
bindAddress
.
sin_family
=
AF_INET
;
bindAddress
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
iret
=
bind
(
src
,
(
struct
sockaddr
*
)
&
bindAddress
,
sizeof
(
bindAddress
));
if
(
iret
!=
0
)
{
skip
(
"failed to bind, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
if
(
set_blocking
(
src
,
FALSE
))
if
((
src
=
setup_iocp_src
(
&
bindAddress
))
==
INVALID_SOCKET
)
{
skip
(
"couldn't make socket non-blocking, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
goto
end
;
}
iret
=
listen
(
src
,
5
);
if
(
iret
!=
0
)
{
skip
(
"listening failed, errno = %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
...
@@ -5485,42 +5510,10 @@ static void test_completion_port(void)
...
@@ -5485,42 +5510,10 @@ static void test_completion_port(void)
ok
(
num_bytes
==
0xdeadbeef
,
"Number of bytes transferred is %u
\n
"
,
num_bytes
);
ok
(
num_bytes
==
0xdeadbeef
,
"Number of bytes transferred is %u
\n
"
,
num_bytes
);
ok
(
!
olp
,
"Overlapped structure is at %p
\n
"
,
olp
);
ok
(
!
olp
,
"Overlapped structure is at %p
\n
"
,
olp
);
src
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
/* */
if
(
src
==
INVALID_SOCKET
)
{
skip
(
"could not create listener socket, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
memset
(
&
bindAddress
,
0
,
sizeof
(
bindAddress
));
if
((
src
=
setup_iocp_src
(
&
bindAddress
))
==
INVALID_SOCKET
)
bindAddress
.
sin_family
=
AF_INET
;
bindAddress
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
iret
=
bind
(
src
,
(
struct
sockaddr
*
)
&
bindAddress
,
sizeof
(
bindAddress
));
if
(
iret
!=
0
)
{
skip
(
"failed to bind, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
goto
end
;
}
socklen
=
sizeof
(
bindAddress
);
iret
=
getsockname
(
src
,
(
struct
sockaddr
*
)
&
bindAddress
,
&
socklen
);
if
(
iret
!=
0
)
{
skip
(
"failed to lookup bind address, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
if
(
set_blocking
(
src
,
FALSE
))
{
skip
(
"couldn't make socket non-blocking, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
iret
=
listen
(
src
,
5
);
if
(
iret
!=
0
)
{
skip
(
"listening failed, errno = %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
connector
==
INVALID_SOCKET
)
{
if
(
connector
==
INVALID_SOCKET
)
{
...
@@ -5575,42 +5568,10 @@ static void test_completion_port(void)
...
@@ -5575,42 +5568,10 @@ static void test_completion_port(void)
if
(
src
!=
INVALID_SOCKET
)
if
(
src
!=
INVALID_SOCKET
)
closesocket
(
dest
);
closesocket
(
dest
);
src
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
/* */
if
(
src
==
INVALID_SOCKET
)
{
skip
(
"could not create listener socket, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
memset
(
&
bindAddress
,
0
,
sizeof
(
bindAddress
));
bindAddress
.
sin_family
=
AF_INET
;
bindAddress
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
iret
=
bind
(
src
,
(
struct
sockaddr
*
)
&
bindAddress
,
sizeof
(
bindAddress
));
if
(
iret
!=
0
)
{
skip
(
"failed to bind, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
socklen
=
sizeof
(
bindAddress
);
if
((
src
=
setup_iocp_src
(
&
bindAddress
))
==
INVALID_SOCKET
)
iret
=
getsockname
(
src
,
(
struct
sockaddr
*
)
&
bindAddress
,
&
socklen
);
if
(
iret
!=
0
)
{
skip
(
"failed to lookup bind address, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
goto
end
;
}
if
(
set_blocking
(
src
,
FALSE
))
{
skip
(
"couldn't make socket non-blocking, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
iret
=
listen
(
src
,
5
);
if
(
iret
!=
0
)
{
skip
(
"listening failed, errno = %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
dest
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
dest
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
dest
==
INVALID_SOCKET
)
if
(
dest
==
INVALID_SOCKET
)
...
@@ -5675,42 +5636,10 @@ static void test_completion_port(void)
...
@@ -5675,42 +5636,10 @@ static void test_completion_port(void)
if
(
connector
!=
INVALID_SOCKET
)
if
(
connector
!=
INVALID_SOCKET
)
closesocket
(
connector
);
closesocket
(
connector
);
src
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
/* */
if
(
src
==
INVALID_SOCKET
)
{
skip
(
"could not create listener socket, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
memset
(
&
bindAddress
,
0
,
sizeof
(
bindAddress
));
bindAddress
.
sin_family
=
AF_INET
;
bindAddress
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
iret
=
bind
(
src
,
(
struct
sockaddr
*
)
&
bindAddress
,
sizeof
(
bindAddress
));
if
(
iret
!=
0
)
{
skip
(
"failed to bind, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
socklen
=
sizeof
(
bindAddress
);
iret
=
getsockname
(
src
,
(
struct
sockaddr
*
)
&
bindAddress
,
&
socklen
);
if
(
iret
!=
0
)
{
skip
(
"failed to lookup bind address, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
if
(
set_blocking
(
src
,
FALSE
))
{
skip
(
"couldn't make socket non-blocking, error %d
\n
"
,
WSAGetLastError
());
goto
end
;
}
iret
=
listen
(
src
,
5
);
if
((
src
=
setup_iocp_src
(
&
bindAddress
))
==
INVALID_SOCKET
)
if
(
iret
!=
0
)
{
skip
(
"listening failed, errno = %d
\n
"
,
WSAGetLastError
());
goto
end
;
goto
end
;
}
dest
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
dest
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
dest
==
INVALID_SOCKET
)
if
(
dest
==
INVALID_SOCKET
)
...
...
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