[Spice-devel] [PATCH spice-gtk] channel: HUP is not an error condition

Marc-André Lureau mlureau at redhat.com
Tue Apr 14 04:52:17 PDT 2015



----- Original Message -----
> On Tue, Apr 14, 2015 at 12:31:47PM +0200, Marc-André Lureau wrote:
> > On local UNIX sockets, calling close() in the server side will result in
> > a HUP condition on client side. Since this is not an error, but a normal
> > termination, let's ignore it.
> 
> Just out of curiosity, do you base this on some documentation/man
> page/... or did you determine that through testing? Any idea if there
> can be cases where HUP would be an error?

Man pages didn't help me much, I did mainly googling and testing.

> 
> > ---
> >  gtk/spice-channel.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> > index 12d61ee..1c19544 100644
> > --- a/gtk/spice-channel.c
> > +++ b/gtk/spice-channel.c
> > @@ -2151,9 +2151,9 @@ static gboolean spice_channel_iterate(SpiceChannel
> > *channel)
> >  
> >          /* We don't want to report an error if the socket was closed
> >          gracefully
> >           * on the other end (VM shutdown) */
> > -        ret = g_socket_condition_check(c->sock, G_IO_IN | G_IO_ERR |
> > G_IO_HUP);
> > +        ret = g_socket_condition_check(c->sock, G_IO_ERR);
> 
> Looks good to me, though I'm not sure why the G_IO_IN which you removed
> was there in the first place.

I don't know, you added this code in:

commit 9cd267a9db91aee10459a4a2bbb984663b03dd9e
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Sep 10 15:50:53 2014 +0200

    Don't report IO error on clean guest shutdown


More information about the Spice-devel mailing list