mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
Fix synchronous reading of stream data
commit 984840a2c2
removed the
notification of waiting calls when VIR_NET_CONTINUE messages
arrive. This was to fix the case of a virStreamAbort() call
being prematurely notified of completion.
The problem is that sometimes there are dummy calls from a
virStreamRecv() call waiting that *do* need to be notified.
These dummy calls should have a status VIR_NET_CONTINUE. So
re-add the notification upon VIR_NET_CONTINUE, but only if
the waiter also has a status of VIR_NET_CONTINUE.
* src/rpc/virnetclient.c: Notify waiting call if stream data
arrives
* src/rpc/virnetclientstream.c: Mark dummy stream read packet
with status VIR_NET_CONTINUE
This commit is contained in:
parent
1888363d8b
commit
cb61009236
@ -627,6 +627,15 @@ static int virNetClientCallDispatchStream(virNetClientPtr client)
|
||||
case VIR_NET_CONTINUE: {
|
||||
if (virNetClientStreamQueuePacket(st, &client->msg) < 0)
|
||||
return -1;
|
||||
|
||||
if (thecall && thecall->expectReply) {
|
||||
if (thecall->msg->header.status == VIR_NET_CONTINUE) {
|
||||
VIR_DEBUG("Got a synchronous confirm");
|
||||
thecall->mode = VIR_NET_CLIENT_MODE_COMPLETE;
|
||||
} else {
|
||||
VIR_DEBUG("Not completing call with status %d", thecall->msg->header.status);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1189,6 +1198,7 @@ int virNetClientSend(virNetClientPtr client,
|
||||
int ret = -1;
|
||||
|
||||
if (expectReply &&
|
||||
(msg->bufferLength != 0) &&
|
||||
(msg->header.status == VIR_NET_CONTINUE)) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Attempt to send an asynchronous message with a synchronous reply"));
|
||||
|
@ -400,6 +400,7 @@ int virNetClientStreamRecvPacket(virNetClientStreamPtr st,
|
||||
msg->header.type = VIR_NET_STREAM;
|
||||
msg->header.serial = st->serial;
|
||||
msg->header.proc = st->proc;
|
||||
msg->header.status = VIR_NET_CONTINUE;
|
||||
|
||||
VIR_DEBUG("Dummy packet to wait for stream data");
|
||||
virMutexUnlock(&st->lock);
|
||||
|
Loading…
Reference in New Issue
Block a user