Re: [PATCH 06/16] Process all pending I/O for a RPC client before checking EOF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 18, 2012 at 05:32:27PM +0100, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> In the socket event handler for the RPC client we must deal
> with read/write events, before checking for EOF, otherwise
> we might close the socket before we've read & acted upon the
> last RPC messages
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/rpc/virnetclient.c |   15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
> index 326efb2..ec82da7 100644
> --- a/src/rpc/virnetclient.c
> +++ b/src/rpc/virnetclient.c
> @@ -1653,13 +1653,6 @@ void virNetClientIncomingEvent(virNetSocketPtr sock,
>  
>      VIR_DEBUG("Event fired %p %d", sock, events);
>  
> -    if (events & (VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR)) {
> -        VIR_DEBUG("%s : VIR_EVENT_HANDLE_HANGUP or "
> -                  "VIR_EVENT_HANDLE_ERROR encountered", __FUNCTION__);
> -        virNetSocketRemoveIOCallback(sock);
> -        goto eof;
> -    }
> -
>      if (events & VIR_EVENT_HANDLE_WRITABLE) {
>          if (virNetClientIOHandleOutput(client) < 0) {
>              virNetSocketRemoveIOCallback(sock);
> @@ -1674,6 +1667,13 @@ void virNetClientIncomingEvent(virNetSocketPtr sock,
>          }
>      }
>  
> +    if (events & (VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR)) {
> +        VIR_DEBUG("%s : VIR_EVENT_HANDLE_HANGUP or "
> +                  "VIR_EVENT_HANDLE_ERROR encountered", __FUNCTION__);
> +        virNetSocketRemoveIOCallback(sock);
> +        goto eof;
> +    }
> +
>      /* Remove completed calls or signal their threads. */
>      virNetClientCallRemovePredicate(&client->waitDispatch,
>                                      virNetClientIOEventLoopRemoveDone,
> @@ -1687,6 +1687,7 @@ done:
>  
>  eof:
>      if (client->eofCb) {
> +        VIR_DEBUG("EOF %p %d", sock, events);
>          virNetClientEOFCallback eofCb = client->eofCb;
>          void *eofOpaque = client->eofOpaque;
>          virNetClientUnlock(client);

  ACK, context depends on 3/16

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]