1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-08 10:43:13 +02:00

core: set "error" field of "output" hashtable in hook_url in case of transfer timeout

This commit is contained in:
Sébastien Helleu
2023-10-13 08:14:31 +02:00
parent a83121b847
commit 6468f7761f
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -598,7 +598,7 @@ hook_process_timer_cb (const void *pointer, void *data, int remaining_calls)
if (weechat_debug_core >= 1)
{
gui_chat_printf (NULL,
_("End of command '%s', timeout reached (%.1fs)"),
_("End of command '%s', timeout reached (%.3fs)"),
HOOK_PROCESS(hook_process, command),
((float)HOOK_PROCESS(hook_process, timeout)) / 1000);
}
+9 -1
View File
@@ -149,6 +149,7 @@ hook_url_timer_cb (const void *pointer, void *data, int remaining_calls)
{
struct t_hook *hook;
const char *ptr_error;
char str_error[1024];
/* make C compiler happy */
(void) data;
@@ -178,12 +179,19 @@ hook_url_timer_cb (const void *pointer, void *data, int remaining_calls)
if (remaining_calls == 0)
{
if (!hashtable_has_key (HOOK_URL(hook, output), "error"))
{
snprintf (str_error, sizeof (str_error),
"transfer timeout reached (%.3fs)",
((float)HOOK_URL(hook, timeout)) / 1000);
hashtable_set (HOOK_URL(hook, output), "error", str_error);
}
hook_url_run_callback (hook);
if (weechat_debug_core >= 1)
{
gui_chat_printf (
NULL,
_("End of URL transfer '%s', timeout reached (%.1fs)"),
_("End of URL transfer '%s', timeout reached (%.3fs)"),
HOOK_URL(hook, url),
((float)HOOK_URL(hook, timeout)) / 1000);
}