mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
Fix release of filtered stream messages
The stream code was reusing a stream message object before it was removed from the linked list of filtered messages. This caused any later queued messages to be completely lost. * daemon/stream.c: Delay reuse of stream message until after it is removed from the queue
This commit is contained in:
parent
d840fe93b0
commit
df65adf136
@ -456,10 +456,6 @@ daemonStreamHandleWriteData(virNetServerClientPtr client,
|
||||
/* Partial write, so indicate we have more todo later */
|
||||
if (msg->bufferOffset < msg->bufferLength)
|
||||
return 1;
|
||||
|
||||
/* A dummy 'send' just to free up 'msg' object */
|
||||
memset(msg, 0, sizeof(*msg));
|
||||
return virNetServerClientSendMessage(client, msg);
|
||||
} else if (ret == -2) {
|
||||
/* Blocking, so indicate we have more todo later */
|
||||
return 1;
|
||||
@ -603,6 +599,22 @@ daemonStreamHandleWrite(virNetServerClientPtr client,
|
||||
virNetServerClientMarkClose(client);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* 'CONTINUE' messages don't send a reply (unless error
|
||||
* occurred), so to release the 'msg' object we need to
|
||||
* send a fake zero-length reply. Nothing actually gets
|
||||
* onto the wire, but this causes the client to reset
|
||||
* its active request count / throttling
|
||||
*/
|
||||
if (msg->header.status == VIR_NET_CONTINUE) {
|
||||
memset(msg, 0, sizeof(*msg));
|
||||
msg->header.type = VIR_NET_REPLY;
|
||||
if (virNetServerClientSendMessage(client, msg) < 0) {
|
||||
virNetMessageFree(msg);
|
||||
virNetServerClientMarkClose(client);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user