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
45bd91b2
Commit
45bd91b2
authored
Sep 25, 2009
by
Mike Kaplinskiy
Committed by
Alexandre Julliard
Sep 25, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Test WSAAccept with CF_DEFER.
parent
3905c7a0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
9 deletions
+37
-9
sock.c
dlls/ws2_32/tests/sock.c
+37
-9
No files found.
dlls/ws2_32/tests/sock.c
View file @
45bd91b2
...
@@ -1949,11 +1949,20 @@ static DWORD WINAPI AcceptKillThread(select_thread_params *par)
...
@@ -1949,11 +1949,20 @@ static DWORD WINAPI AcceptKillThread(select_thread_params *par)
return
0
;
return
0
;
}
}
static
int
CALLBACK
AlwaysDeferConditionFunc
(
LPWSABUF
lpCallerId
,
LPWSABUF
lpCallerData
,
LPQOS
pQos
,
LPQOS
lpGQOS
,
LPWSABUF
lpCalleeId
,
LPWSABUF
lpCalleeData
,
GROUP
FAR
*
g
,
DWORD_PTR
dwCallbackData
)
{
return
CF_DEFER
;
}
static
void
test_accept
(
void
)
static
void
test_accept
(
void
)
{
{
int
ret
;
int
ret
;
SOCKET
server_socket
=
INVALID_SOCKET
;
SOCKET
server_socket
=
INVALID_SOCKET
,
accepted
=
INVALID_SOCKET
,
connector
=
INVALID_SOCKET
;
struct
sockaddr_in
address
;
struct
sockaddr_in
address
;
int
socklen
;
select_thread_params
thread_params
;
select_thread_params
thread_params
;
HANDLE
thread_handle
=
NULL
;
HANDLE
thread_handle
=
NULL
;
DWORD
id
;
DWORD
id
;
...
@@ -1966,6 +1975,7 @@ static void test_accept(void)
...
@@ -1966,6 +1975,7 @@ static void test_accept(void)
}
}
memset
(
&
address
,
0
,
sizeof
(
address
));
memset
(
&
address
,
0
,
sizeof
(
address
));
address
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
address
.
sin_family
=
AF_INET
;
address
.
sin_family
=
AF_INET
;
ret
=
bind
(
server_socket
,
(
struct
sockaddr
*
)
&
address
,
sizeof
(
address
));
ret
=
bind
(
server_socket
,
(
struct
sockaddr
*
)
&
address
,
sizeof
(
address
));
if
(
ret
!=
0
)
if
(
ret
!=
0
)
...
@@ -1974,13 +1984,34 @@ static void test_accept(void)
...
@@ -1974,13 +1984,34 @@ static void test_accept(void)
goto
done
;
goto
done
;
}
}
ret
=
listen
(
server_socket
,
1
);
socklen
=
sizeof
(
address
);
ret
=
getsockname
(
server_socket
,
(
struct
sockaddr
*
)
&
address
,
&
socklen
);
if
(
ret
!=
0
)
{
skip
(
"failed to lookup bind address, error %d
\n
"
,
WSAGetLastError
());
goto
done
;
}
ret
=
listen
(
server_socket
,
5
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
{
{
trace
(
"error making server socket listen: %d
\n
"
,
WSAGetLastError
());
trace
(
"error making server socket listen: %d
\n
"
,
WSAGetLastError
());
goto
done
;
goto
done
;
}
}
trace
(
"Blocking accept next
\n
"
);
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
connector
!=
INVALID_SOCKET
,
"Failed to create connector socket, error %d
\n
"
,
WSAGetLastError
());
ret
=
connect
(
connector
,
(
struct
sockaddr
*
)
&
address
,
sizeof
(
address
));
ok
(
ret
==
0
,
"connecting to accepting socket failed, error %d
\n
"
,
WSAGetLastError
());
accepted
=
WSAAccept
(
server_socket
,
NULL
,
NULL
,
(
LPCONDITIONPROC
)
AlwaysDeferConditionFunc
,
0
);
ok
(
accepted
==
INVALID_SOCKET
&&
WSAGetLastError
()
==
WSATRY_AGAIN
,
"Failed to defer connection, %d
\n
"
,
WSAGetLastError
());
accepted
=
accept
(
server_socket
,
NULL
,
0
);
ok
(
accepted
!=
INVALID_SOCKET
,
"Failed to accept deferred connection, error %d
\n
"
,
WSAGetLastError
());
server_ready
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
server_ready
=
CreateEventA
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
server_ready
==
INVALID_HANDLE_VALUE
)
if
(
server_ready
==
INVALID_HANDLE_VALUE
)
{
{
...
@@ -2011,6 +2042,10 @@ static void test_accept(void)
...
@@ -2011,6 +2042,10 @@ static void test_accept(void)
ok
(
thread_params
.
ReadKilled
,
"closesocket did not wakeup accept
\n
"
);
ok
(
thread_params
.
ReadKilled
,
"closesocket did not wakeup accept
\n
"
);
done:
done:
if
(
accepted
!=
INVALID_SOCKET
)
closesocket
(
accepted
);
if
(
connector
!=
INVALID_SOCKET
)
closesocket
(
connector
);
if
(
thread_handle
!=
NULL
)
if
(
thread_handle
!=
NULL
)
CloseHandle
(
thread_handle
);
CloseHandle
(
thread_handle
);
if
(
server_ready
!=
INVALID_HANDLE_VALUE
)
if
(
server_ready
!=
INVALID_HANDLE_VALUE
)
...
@@ -2757,13 +2792,6 @@ static void test_GetAddrInfoW(void)
...
@@ -2757,13 +2792,6 @@ static void test_GetAddrInfoW(void)
pFreeAddrInfoW
(
result
);
pFreeAddrInfoW
(
result
);
}
}
static
int
CALLBACK
AlwaysDeferConditionFunc
(
LPWSABUF
lpCallerId
,
LPWSABUF
lpCallerData
,
LPQOS
pQos
,
LPQOS
lpGQOS
,
LPWSABUF
lpCalleeId
,
LPWSABUF
lpCalleeData
,
GROUP
FAR
*
g
,
DWORD_PTR
dwCallbackData
)
{
return
CF_DEFER
;
}
static
void
test_AcceptEx
(
void
)
static
void
test_AcceptEx
(
void
)
{
{
SOCKET
listener
=
INVALID_SOCKET
;
SOCKET
listener
=
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