Stopping reading off wire after 1 complete RPC message is received

This commit is contained in:
Daniel P. Berrange 2009-01-28 22:00:32 +00:00
parent ca9af16aa7
commit 46d1324e47
2 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Wed Jan 28 21:55:11 GMT 2009 Daniel P.Berrange <berrange@redhat.com>
* src/remote_internal.c: Stop reading data off wire once
a single complete message is available.
Wed Jan 28 21:53:11 GMT 2009 Daniel P.Berrange <berrange@redhat.com>
Fix bogus valgrind memory leak warnings

View File

@ -6135,12 +6135,27 @@ processCallRecv(virConnectPtr conn, struct private_data *priv,
if (priv->bufferOffset == priv->bufferLength) {
if (priv->bufferOffset == 4) {
ret = processCallRecvLen(conn, priv, in_open);
if (ret < 0)
return -1;
/*
* We'll carry on around the loop to immediately
* process the message body, because it has probably
* already arrived. Worst case, we'll get EAGAIN on
* next iteration.
*/
} else {
ret = processCallRecvMsg(conn, priv, in_open);
priv->bufferOffset = priv->bufferLength = 0;
/*
* We've completed one call, so return even
* though there might still be more data on
* the wire. We need to actually let the caller
* deal with this arrived message to keep good
* response, and also to correctly handle EOF.
*/
return ret;
}
if (ret < 0)
return -1;
}
}
}