1
0
Fork 0
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:
grorp 2024-03-12 20:09:43 +01:00 committed by GitHub
parent 32f68f35cf
commit f07e1026ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 56 additions and 11 deletions

View file

@ -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);