summaryrefslogtreecommitdiff
path: root/0001-connectivity-Make-curl-timeout-callback-non-repeatin.patch
blob: f3f547cd156876fef3e292de5ed36d4bd8bda378 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Date: Fri, 13 Oct 2023 16:46:09 +0000
Subject: [PATCH] connectivity: Make curl timeout callback non-repeating.

The CURLMOPT_TIMERFUNCTION manual says:
    Your callback function timer_callback should install a *non-repeating*
    timer with an expire time of timeout_ms milliseconds.

The previous callback returned G_SOURCE_CONTINUE, resulting in a repeating
firing callback. curl tweaked some internals in v8.4.0 and started giving
0 timeouts, which caused this to wreak havoc.

Fix it by making the callback non-repeating as specified by the API contract.
---
 src/core/nm-connectivity.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/nm-connectivity.c b/src/core/nm-connectivity.c
index 92de44f17d99..d8b0004c381f 100644
--- a/src/core/nm-connectivity.c
+++ b/src/core/nm-connectivity.c
@@ -406,9 +406,10 @@ _con_curl_timeout_cb(gpointer user_data)
 {
     NMConnectivityCheckHandle *cb_data = user_data;
 
+    cb_data->concheck.curl_timer = 0;
     _con_curl_check_connectivity(cb_data->concheck.curl_mhandle, CURL_SOCKET_TIMEOUT, 0);
     _complete_queued(cb_data->self);
-    return G_SOURCE_CONTINUE;
+    return G_SOURCE_REMOVE;
 }
 
 static int