diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 005c2685a8..1a96bbe48a 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1551,7 +1551,7 @@ virNetServerClientStartKeepAlive(virNetServerClientPtr client)
     /* The connection might have been closed before we got here and thus the
      * keepalive object could have been removed too.
      */
-    if (!client->sock) {
+    if (!client->keepalive) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("connection not open"));
         goto cleanup;