Blame SOURCES/bz2180246-1-qdevice-Destroy-non-blocking-client-on-failure.patch

71f5b5
From 4331c7d5650a8bf44c16512419f1954d0ef96df5 Mon Sep 17 00:00:00 2001
71f5b5
From: Jan Friesse <jfriesse@redhat.com>
71f5b5
Date: Mon, 20 Mar 2023 11:01:46 +0100
71f5b5
Subject: [PATCH] qdevice: Destroy non blocking client on failure
71f5b5
71f5b5
This fixes regression introduced in patch
71f5b5
8217e33e86bca79dc307e112f0c0c4a278f9a568 which made qdevice assert when
71f5b5
PR_GetError in nss_sock_non_blocking_client_try_next called by
71f5b5
qdevice_model_net_pre_poll_loop returns error other than
71f5b5
PR_IN_PROGRESS_ERROR. This is usually not happening - only way to get
71f5b5
such error seems to be to ifdown ALL network interfaces other than
71f5b5
loopback and returned error is then PR_NETWORK_UNREACHABLE_ERROR
71f5b5
(-5980).
71f5b5
71f5b5
Fix is rather simple (and present in pre
71f5b5
8217e33e86bca79dc307e112f0c0c4a278f9a568) - just call
71f5b5
nss_sock_non_blocking_client_destroy.
71f5b5
71f5b5
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
71f5b5
---
71f5b5
 qdevices/qdevice-model-net.c | 4 ++++
71f5b5
 1 file changed, 4 insertions(+)
71f5b5
71f5b5
diff --git a/qdevices/qdevice-model-net.c b/qdevices/qdevice-model-net.c
71f5b5
index afcc649..f63e4bd 100644
71f5b5
--- a/qdevices/qdevice-model-net.c
71f5b5
+++ b/qdevices/qdevice-model-net.c
71f5b5
@@ -211,6 +211,10 @@ qdevice_model_net_pre_poll_loop(struct qdevice_instance *instance)
71f5b5
 	res = nss_sock_non_blocking_client_try_next(&net_instance->non_blocking_client);
71f5b5
 	if (res == -1) {
71f5b5
 		log_nss(LOG_ERR, "Can't connect to qnetd host");
71f5b5
+		/*
71f5b5
+		 * To prevent adding non_blocking_client into loop but still keep loop running
71f5b5
+		 */
71f5b5
+		nss_sock_non_blocking_client_destroy(&net_instance->non_blocking_client);
71f5b5
 	}
71f5b5
 
71f5b5
 	res = qdevice_net_socket_add_to_main_poll_loop(net_instance);
71f5b5
-- 
71f5b5
2.39.1
71f5b5