aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Denemark <jdenemar@redhat.com>2011-11-28 17:41:25 +0100
committerJiri Denemark <jdenemar@redhat.com>2011-11-29 08:43:00 +0100
commit4e511fcc18aa4929ee0b46d91251dd4a2fb2a194 (patch)
tree45dd2fff4c1ad9d121c013b0894e9311b9556688 /src/rpc/virnetclient.c
parentvirsh: Don't traverse childless nodes in vshNodeIsSuperset (diff)
downloadlibvirt-4e511fcc18aa4929ee0b46d91251dd4a2fb2a194.tar.gz
libvirt-4e511fcc18aa4929ee0b46d91251dd4a2fb2a194.tar.bz2
libvirt-4e511fcc18aa4929ee0b46d91251dd4a2fb2a194.zip
rpc: Really send non-blocking calls while waiting for another call
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.
Diffstat (limited to 'src/rpc/virnetclient.c')
-rw-r--r--src/rpc/virnetclient.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index aad7f5d79..a73812962 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -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) {