On 6/28/2024 2:26 AM, Purna Pavan Chandra wrote:
chSocketRecv fn can be used by operations such as restore, which cannot
have a specific poll timeout. The runtime of these operations at server
side (vmm) cannot be determined or capped as it depends on the guest
configuration. Hence, pass -1 as timeout to poll to make wait until
there's a response from server.
Signed-off-by: Purna Pavan Chandra <paekkaladevi@xxxxxxxxxxxxxxxxxxx>
---
src/ch/ch_process.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c
index 668a53a1c2..3f2a3f81e5 100644
--- a/src/ch/ch_process.c
+++ b/src/ch/ch_process.c
@@ -530,9 +530,6 @@ chMonitorSocketConnect(virCHMonitor *mon)
return -1;
}
-
-#define PKT_TIMEOUT_MS 500 /* ms */
-
static char *
chSocketRecv(int sock)
{
@@ -547,7 +544,7 @@ chSocketRecv(int sock)
pfds[0].events = POLLIN;
do {
- ret = poll(pfds, G_N_ELEMENTS(pfds), PKT_TIMEOUT_MS);
+ ret = poll(pfds, G_N_ELEMENTS(pfds), -1);
As we'd like "restore" operation to be synchronous we can keep polling
until libvirt gets a response.
But for rest of the operations, we should retain the timeout. For
example, if CH process crashes after receiving the request to add net
FDs, we'd like Libvirt to continue instead of waiting for a response
forever.
You can add an additional argument to this function to choose if timeout
should be used or not. And not use the timeout during restore operation.
} while (ret < 0 && errno == EINTR);
if (ret <= 0) {
@@ -571,8 +568,6 @@ chSocketRecv(int sock)
return g_steal_pointer(&buf);
}
-#undef PKT_TIMEOUT_MS
-
static int
chSocketProcessHttpResponse(int sock)
{
--
Regards,
Praveen