diff options
| author | Michael Biebl <biebl@debian.org> | 2024-09-01 22:38:35 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2024-09-01 22:38:35 +0200 |
| commit | f9bfd1158b8d08d6a5ed3bb7cc1ba7a6455e5201 (patch) | |
| tree | 10267dcf5b842b7c638a79bd6851549cd849b81d /src/core/nm-connectivity.c | |
| parent | 681dfc70ef98f6ed0c05bcb0fbff00e3fc0799ea (diff) | |
New upstream version 1.49.90 upstream/1.49.90
Diffstat (limited to 'src/core/nm-connectivity.c')
| -rw-r--r-- | src/core/nm-connectivity.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/nm-connectivity.c b/src/core/nm-connectivity.c index 15dc31aa..65eec36d 100644 --- a/src/core/nm-connectivity.c +++ b/src/core/nm-connectivity.c @@ -56,6 +56,7 @@ typedef struct { char *host; char *port; char *response; + guint timeout; } ConConfig; struct _NMConnectivityCheckHandle { @@ -738,7 +739,9 @@ do_curl_request(NMConnectivityCheckHandle *cb_data, const char *hosts) cb_data->concheck.curl_mhandle = mhandle; cb_data->concheck.curl_ehandle = ehandle; cb_data->concheck.request_headers = curl_slist_append(NULL, "Connection: close"); - cb_data->timeout_source = nm_g_timeout_add_seconds_source(20, _timeout_cb, cb_data); + cb_data->timeout_source = nm_g_timeout_add_seconds_source(cb_data->concheck.con_config->timeout, + _timeout_cb, + cb_data); curl_multi_setopt(mhandle, CURLMOPT_SOCKETFUNCTION, multi_socket_cb); curl_multi_setopt(mhandle, CURLMOPT_SOCKETDATA, cb_data); @@ -1226,6 +1229,7 @@ update_config(NMConnectivity *self, NMConfigData *config_data) { NMConnectivityPrivate *priv = NM_CONNECTIVITY_GET_PRIVATE(self); guint interval; + guint new_timeout; gboolean enabled; gboolean changed = FALSE; const char *cur_uri = priv->con_config ? priv->con_config->uri : NULL; @@ -1237,6 +1241,8 @@ update_config(NMConnectivity *self, NMConfigData *config_data) gs_free char *new_host = NULL; gs_free char *new_port = NULL; + new_timeout = nm_config_data_get_connectivity_timeout(config_data); + new_uri = nm_config_data_get_connectivity_uri(config_data); if (!nm_streq0(new_uri, cur_uri)) { new_uri_valid = (new_uri && *new_uri); @@ -1277,6 +1283,7 @@ update_config(NMConnectivity *self, NMConfigData *config_data) changed = TRUE; if (!priv->con_config || !nm_streq0(new_uri, priv->con_config->uri) + || new_timeout != priv->con_config->timeout || !nm_streq0(new_response, priv->con_config->response)) { if (!new_host_port) { new_host = priv->con_config ? g_strdup(priv->con_config->host) : NULL; @@ -1290,6 +1297,7 @@ update_config(NMConnectivity *self, NMConfigData *config_data) .response = g_strdup(new_response), .host = g_steal_pointer(&new_host), .port = g_steal_pointer(&new_port), + .timeout = new_timeout, }; } priv->uri_valid = new_uri_valid; |