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
f75a8b35
Commit
f75a8b35
authored
Nov 17, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
Nov 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp/tests: Avoid race condition on closing connection in server_thread().
The connection may be cached and checked for availability for request before the server thread closes it.
parent
645a65cb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
notification.c
dlls/winhttp/tests/notification.c
+6
-2
No files found.
dlls/winhttp/tests/notification.c
View file @
f75a8b35
...
...
@@ -1401,7 +1401,7 @@ struct server_info
};
static
int
server_socket
;
static
HANDLE
server_socket_available
,
server_socket_done
;
static
HANDLE
server_socket_available
,
server_socket_
closed
,
server_socket_
done
;
static
DWORD
CALLBACK
server_thread
(
LPVOID
param
)
{
...
...
@@ -1436,7 +1436,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
do
{
if
(
c
==
-
1
)
c
=
accept
(
s
,
NULL
,
NULL
);
ResetEvent
(
server_socket_closed
);
memset
(
buffer
,
0
,
sizeof
buffer
);
for
(
i
=
0
;
i
<
sizeof
buffer
-
1
;
i
++
)
{
...
...
@@ -1463,6 +1463,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
}
shutdown
(
c
,
2
);
closesocket
(
c
);
SetEvent
(
server_socket_closed
);
c
=
-
1
;
}
while
(
!
last_request
);
...
...
@@ -1749,6 +1750,7 @@ static void test_persistent_connection(int port)
SetEvent
(
server_socket_done
);
CloseHandle
(
info
.
wait
);
WaitForSingleObject
(
server_socket_closed
,
INFINITE
);
}
struct
test_recursion_context
...
...
@@ -1929,6 +1931,7 @@ START_TEST (notification)
ok
(
thread
!=
NULL
,
"failed to create thread %lu
\n
"
,
GetLastError
()
);
server_socket_available
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
server_socket_closed
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
server_socket_done
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
ret
=
WaitForSingleObject
(
si
.
event
,
10000
);
...
...
@@ -1948,4 +1951,5 @@ START_TEST (notification)
CloseHandle
(
thread
);
CloseHandle
(
server_socket_available
);
CloseHandle
(
server_socket_done
);
CloseHandle
(
server_socket_closed
);
}
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