]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
rpc: Really send non-blocking calls while waiting for another call
authorJiri Denemark <jdenemar@redhat.com>
Mon, 28 Nov 2011 16:41:25 +0000 (17:41 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 29 Nov 2011 07:43:00 +0000 (08:43 +0100)
When another thread was dispatching while we wanted to send a
non-blocking call, we correctly queued the call and woke up the thread
but the thread just threw the call away since it forgot to recheck if
its socket was writable.

src/rpc/virnetclient.c

index aad7f5d79b3695e24cfbf9c9b60830a78ae6fd27..a738129623c884f1425117b5a4269da2a7b8f0ad 100644 (file)
@@ -1381,6 +1381,16 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
                                      _("read on wakeup fd failed"));
                 goto error;
             }
+
+            /* If we were woken up because a new non-blocking call was queued,
+             * we need to re-poll to check if we can send it.
+             */
+            if (virNetClientCallMatchPredicate(client->waitDispatch,
+                                               virNetClientIOEventLoopWantNonBlock,
+                                               NULL)) {
+                VIR_DEBUG("New non-blocking call arrived; repolling");
+                continue;
+            }
         }
 
         if (ret < 0) {