mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Allow sync HTTP fetches to be interrupted to fix hanging (#14412)
Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
This commit is contained in:
parent
32f68f35cf
commit
f07e1026ac
6 changed files with 56 additions and 11 deletions
|
@ -135,6 +135,9 @@ u64 httpfetch_caller_alloc_secure();
|
|||
// to stop any ongoing fetches for the given caller.
|
||||
void httpfetch_caller_free(u64 caller);
|
||||
|
||||
// Performs a synchronous HTTP request. This blocks and therefore should
|
||||
// only be used from background threads.
|
||||
void httpfetch_sync(const HTTPFetchRequest &fetch_request, HTTPFetchResult &fetch_result);
|
||||
// Performs a synchronous HTTP request that is interruptible if the current
|
||||
// thread is a Thread object. interval is the completion check interval in ms.
|
||||
// This blocks and therefore should only be used from background threads.
|
||||
// Returned is whether the request completed without interruption.
|
||||
bool httpfetch_sync_interruptible(const HTTPFetchRequest &fetch_request,
|
||||
HTTPFetchResult &fetch_result, long interval = 100);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue