提交 df65adf1 编写于 作者: D Daniel P. Berrange

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
上级 d840fe93
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册