The value of nrequests should always be zero or positive but in the case of stream, when error occurrs, it could be negative and makes the client socket fd neither writable nor readable. The case will lead to hang on libvirt client side. This patch aim to fix the problem. --- src/rpc/virnetserverclient.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index a73b06d..882ba77 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -78,8 +78,8 @@ struct _virNetServerClient * ie RPC calls in progress. Does not count * async events which are not used for * throttling calculations */ - size_t nrequests; - size_t nrequests_max; + ssize_t nrequests; + ssize_t nrequests_max; /* Zero or one messages being received. Zero if * nrequests >= max_clients and throttling */ virNetMessagePtr rx; @@ -889,6 +889,10 @@ virNetServerClientDispatchWrite(virNetServerClientPtr client) (msg->header.type == VIR_NET_STREAM && msg->header.status != VIR_NET_CONTINUE)) { client->nrequests--; + + if (client->nrequests < 0) + client->nrequests = 0; + /* See if the recv queue is currently throttled */ if (!client->rx && client->nrequests < client->nrequests_max) { -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list