[PATCH v2 1/2] rpc: Report proper close reason for keepalive disconnections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Whenever client socket was disconnected due to keepalive timeout, the
I/O event loop did not exit and continued until the point where the
hangup was found.  Ending with an error right away when the
keepalive times out takes care of this problem.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/rpc/virkeepalive.c | 11 ++++++-----
 src/rpc/virnetclient.c |  1 +
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c
index c882313..f382f93 100644
--- a/src/rpc/virkeepalive.c
+++ b/src/rpc/virkeepalive.c
@@ -136,11 +136,12 @@ virKeepAliveTimerInternal(virKeepAlivePtr ka,
           ka, ka->client, ka->countToDeath, timeval);

     if (ka->countToDeath == 0) {
-        VIR_WARN("No response from client %p after %d keepalive messages in"
-                 " %d seconds",
-                 ka->client,
-                 ka->count,
-                 timeval);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("No response from client %p after %d keepalive messages in"
+                         " %d seconds"),
+                       ka->client,
+                       ka->count,
+                       timeval);
         return true;
     } else {
         ka->countToDeath--;
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 8657b0e..ac4850c 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1525,6 +1525,7 @@ static int virNetClientIOEventLoop(virNetClientPtr client,

         if (virKeepAliveTrigger(client->keepalive, &msg)) {
             virNetClientMarkClose(client, VIR_CONNECT_CLOSE_REASON_KEEPALIVE);
+            goto error;
         } else if (msg && virNetClientQueueNonBlocking(client, msg) < 0) {
             VIR_WARN("Could not queue keepalive request");
             virNetMessageFree(msg);
-- 
2.1.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]