mirror of https://gitee.com/openkylin/libvirt.git
Don't attempt to read from a stream if it is closed
The I/O event callback processes incoming packets first, and then does outgoing packets. If the incoming packet caused the stream to close, then the attempt to process outgoing data resulted in an error. This caused libvirt to then send an error back to the client, but the stream had already been stopped. This confused the client since it sees 2 error events. * daemon/stream.c: Don't attempt read if stream is closed
This commit is contained in:
parent
108ca33357
commit
dbf04dac3e
|
@ -678,7 +678,15 @@ daemonStreamHandleRead(virNetServerClientPtr client,
|
|||
size_t bufferLen = VIR_NET_MESSAGE_PAYLOAD_MAX;
|
||||
int ret;
|
||||
|
||||
VIR_DEBUG("client=%p, stream=%p", client, stream);
|
||||
VIR_DEBUG("client=%p, stream=%p tx=%d closed=%d",
|
||||
client, stream, stream->tx, stream->closed);
|
||||
|
||||
/* We might have had an event pending before we shut
|
||||
* down the stream, so if we're marked as closed,
|
||||
* then do nothing
|
||||
*/
|
||||
if (stream->closed)
|
||||
return 0;
|
||||
|
||||
/* Shouldn't ever be called unless we're marked able to
|
||||
* transmit, but doesn't hurt to check */
|
||||
|
|
Loading…
Reference in New Issue