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

Marc-André Lureau marcandre.lureau at redhat.com
Tue Apr 14 03:31:47 PDT 2015


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.

A clean shutdown would involve a new message to tell the client to first
close its end, in order to avoid the HUP. That way the client could
distinguish normal termination from unexpected ones. That's a possible
future minor enhancement (it seems it would only work with UNIX socket
though)

https://bugs.freedesktop.org/show_bug.cgi?id=90016
---
 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);
 
-        if (ret & (G_IO_ERR|G_IO_HUP)) {
+        if (ret & G_IO_ERR) {
             CHANNEL_DEBUG(channel, "channel got error");
 
             if (c->state > SPICE_CHANNEL_STATE_CONNECTING) {
-- 
2.1.0



More information about the Spice-devel mailing list