Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
539f2f15
Commit
539f2f15
authored
Nov 23, 2018
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Use the thread pool for asynchronous hostname resolution.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c6251cbb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
22 deletions
+24
-22
net.c
dlls/winhttp/net.c
+24
-22
No files found.
dlls/winhttp/net.c
View file @
539f2f15
...
...
@@ -651,42 +651,44 @@ static DWORD resolve_hostname( const WCHAR *name, INTERNET_PORT port, struct soc
return
ERROR_SUCCESS
;
}
struct
resolve_args
struct
async_resolve
{
const
WCHAR
*
hostname
;
INTERNET_PORT
port
;
struct
sockaddr_storage
*
sa
;
struct
sockaddr_storage
*
addr
;
DWORD
result
;
HANDLE
done
;
};
static
DWORD
CALLBACK
resolve_proc
(
LPVOID
arg
)
static
void
CALLBACK
resolve_proc
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
ctx
)
{
struct
resolve_args
*
ra
=
arg
;
return
resolve_hostname
(
ra
->
hostname
,
ra
->
port
,
ra
->
sa
);
struct
async_resolve
*
async
=
ctx
;
async
->
result
=
resolve_hostname
(
async
->
hostname
,
async
->
port
,
async
->
addr
);
SetEvent
(
async
->
done
);
}
BOOL
netconn_resolve
(
WCHAR
*
hostname
,
INTERNET_PORT
port
,
struct
sockaddr_storage
*
sa
,
int
timeout
)
BOOL
netconn_resolve
(
WCHAR
*
hostname
,
INTERNET_PORT
port
,
struct
sockaddr_storage
*
addr
,
int
timeout
)
{
DWORD
ret
;
if
(
timeout
)
if
(
!
timeout
)
ret
=
resolve_hostname
(
hostname
,
port
,
addr
);
else
{
DWORD
status
;
HANDLE
thread
;
struct
resolve_args
ra
;
ra
.
hostname
=
hostname
;
ra
.
port
=
port
;
ra
.
sa
=
sa
;
thread
=
CreateThread
(
NULL
,
0
,
resolve_proc
,
&
ra
,
0
,
NULL
);
if
(
!
thread
)
return
FALSE
;
struct
async_resolve
async
;
status
=
WaitForSingleObject
(
thread
,
timeout
);
if
(
status
==
WAIT_OBJECT_0
)
GetExitCodeThread
(
thread
,
&
ret
);
else
ret
=
ERROR_WINHTTP_TIMEOUT
;
CloseHandle
(
thread
);
async
.
hostname
=
hostname
;
async
.
port
=
port
;
async
.
addr
=
addr
;
if
(
!
(
async
.
done
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
)))
return
FALSE
;
if
(
!
TrySubmitThreadpoolCallback
(
resolve_proc
,
&
async
,
NULL
))
{
CloseHandle
(
async
.
done
);
return
FALSE
;
}
if
(
WaitForSingleObject
(
async
.
done
,
timeout
)
!=
WAIT_OBJECT_0
)
ret
=
ERROR_WINHTTP_TIMEOUT
;
else
ret
=
async
.
result
;
CloseHandle
(
async
.
done
);
}
else
ret
=
resolve_hostname
(
hostname
,
port
,
sa
);
if
(
ret
)
{
...
...
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