1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-06 22:43:12 +02:00

URL API: add request->connect_timeout & request->transfer_timeout

... in case you want to do fine-tuning.

Defaults to DOWNLOAD_CONNECT_TIMEOUT (15 seconds) and
DOWNLOAD_TRANSFER_TIMEOUT (20 seconds).

For example, the module manager uses a shorter timeout of 7 and 20.
(that was already the case, but now it uses the generic api so
 it needed an option to set it to those values)
This commit is contained in:
Bram Matthys
2023-11-24 14:34:54 +01:00
parent 9d3af7f22a
commit 7d024f8086
6 changed files with 23 additions and 13 deletions
+3 -3
View File
@@ -8,7 +8,7 @@
#ifndef _WIN32
#define MODULEMANAGER_CONNECT_TIMEOUT 7
#define MODULEMANAGER_READ_TIMEOUT 20
#define MODULEMANAGER_TRANSFER_TIMEOUT 20
typedef struct ManagedModule ManagedModule;
@@ -618,7 +618,7 @@ int mm_refresh_repository(void)
}
printf("Checking module repository %s...\n", line);
numrepos++;
tmpfile = synchronous_http_request(line, 1, MODULEMANAGER_CONNECT_TIMEOUT, MODULEMANAGER_READ_TIMEOUT);
tmpfile = synchronous_http_request(line, 1, MODULEMANAGER_CONNECT_TIMEOUT, MODULEMANAGER_TRANSFER_TIMEOUT);
if (tmpfile)
{
if (!mm_parse_repo_db(line, tmpfile))
@@ -960,7 +960,7 @@ void mm_install_module(ManagedModule *m)
const char *tmpfile;
printf("Downloading %s from %s...\n", m->name, m->source);
tmpfile = synchronous_http_request(m->source, 1, MODULEMANAGER_CONNECT_TIMEOUT, MODULEMANAGER_READ_TIMEOUT);
tmpfile = synchronous_http_request(m->source, 1, MODULEMANAGER_CONNECT_TIMEOUT, MODULEMANAGER_TRANSFER_TIMEOUT);
if (!tmpfile)
{
fprintf(stderr, "Repository %s seems to list a module file that cannot be retrieved (%s).\n", m->repo_url, m->source);