[libvirt] [PATCH 3/4] rpc: Fix handling of non-blocking calls that could not be sent

Daniel P. Berrange berrange at redhat.com
Tue Nov 22 19:32:52 UTC 2011


On Tue, Nov 22, 2011 at 04:32:33PM +0100, Jiri Denemark wrote:
> When virNetClientIOEventLoop is called for a non-blocking call and not
> even a single byte can be sent from this call without blocking, we
> properly reported that to the caller which properly frees the call. But
> we never removed the call from a call queue.
> ---
>  src/rpc/virnetclient.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
> index 0effceb..c99e87c 100644
> --- a/src/rpc/virnetclient.c
> +++ b/src/rpc/virnetclient.c
> @@ -1256,7 +1256,12 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
>          /* We're not done, but we're non-blocking */
>          if (thiscall->nonBlock) {
>              virNetClientIOEventLoopPassTheBuck(client, thiscall);
> -            return thiscall->sentSomeData ? 1 : 0;
> +            if (thiscall->sentSomeData) {
> +                return 1;
> +            } else {
> +                virNetClientCallRemove(&client->waitDispatch, thiscall);
> +                return 0;
> +            }
>          }
>  
>          if (fds[0].revents & (POLLHUP | POLLERR)) {

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list