diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 7830b7fff2..52b4941294 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1546,7 +1546,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;