[igt-dev] [PATCH i-g-t v2] lib/igt_chamelium: Use curl timeout for xmlrpc calls
Petri Latvala
petri.latvala at intel.com
Wed Sep 30 11:53:07 UTC 2020
Use of timeouts everywhere is meaningless if xmlrpc calls are allowed
to be blocking forever.
v2: Use milliseconds correctly (Juha-Pekka)
Signed-off-by: Petri Latvala <petri.latvala at intel.com>
Cc: Kunal Joshi <kunal1.joshi at intel.com>
Cc: Arkadiusz Hiler <arek at hiler.eu>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com> #v1
---
lib/igt_chamelium.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index d9fab902..585fdfa8 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -2427,11 +2427,22 @@ void chamelium_deinit_rpc_only(struct chamelium *chamelium)
struct chamelium *chamelium_init_rpc_only(void)
{
struct chamelium *chamelium = malloc(sizeof(struct chamelium));
+ struct xmlrpc_clientparms clientparms;
+ struct xmlrpc_curl_xportparms curlparms;
if (!chamelium)
return NULL;
memset(chamelium, 0, sizeof(*chamelium));
+ memset(&clientparms, 0, sizeof(clientparms));
+ memset(&curlparms, 0, sizeof(curlparms));
+
+ /* curl's timeout is in milliseconds */
+ curlparms.timeout = _RECEIVER_RESPONSIVE_AFTER_RESET_SECONDS * 1000;
+
+ clientparms.transport = "curl";
+ clientparms.transportparmsP = &curlparms;
+ clientparms.transportparm_size = XMLRPC_CXPSIZE(timeout);
chamelium->drm_fd = -1;
@@ -2439,7 +2450,7 @@ struct chamelium *chamelium_init_rpc_only(void)
xmlrpc_env_init(&chamelium->env);
xmlrpc_client_setup_global_const(&chamelium->env);
xmlrpc_client_create(&chamelium->env, XMLRPC_CLIENT_NO_FLAGS, PACKAGE,
- PACKAGE_VERSION, NULL, 0, &chamelium->client);
+ PACKAGE_VERSION, &clientparms, 0, &chamelium->client);
if (chamelium->env.fault_occurred) {
igt_debug("Failed to init xmlrpc: %s\n",
chamelium->env.fault_string);
--
2.20.1
More information about the igt-dev
mailing list