[Spice-commits] 2 commits - gtk/spice-channel.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Tue Apr 14 06:32:37 PDT 2015

 gtk/spice-channel.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 372716d93ed929498e61305042815952f582fa0d
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Tue Apr 14 12:17:38 2015 +0200

    channel: HUP is not an error condition
    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
    G_IO_IN seemed to be a leftover, it is left here but shouldn't be

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 12d61ee..4e7d8b7 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_IN | 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) {
commit eac2a4243c38cf68e9f40e43008f9bccfb5649e2
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Apr 13 14:43:40 2015 +0200

    channel: reset c->has_error when connected
    Whenever the channel socket is connected, c->has_error should be reset.
    Until now, only the regular open_host() case was reset, but client
    client provided fd must also reset the error state.
    It should be safe to move it after the "connected" label, since the
    ssl code doesn't need c->has_error.

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 95eb615..12d61ee 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2331,8 +2331,6 @@ reconnect:
     c->sock = g_object_ref(g_socket_connection_get_socket(c->conn));
-    c->has_error = FALSE;
     if (c->tls) {
         c->ctx = SSL_CTX_new(SSLv23_method());
         if (c->ctx == NULL) {
@@ -2407,6 +2405,7 @@ ssl_reconnect:
+    c->has_error = FALSE;
     c->in = g_io_stream_get_input_stream(G_IO_STREAM(c->conn));
     c->out = g_io_stream_get_output_stream(G_IO_STREAM(c->conn));

More information about the Spice-commits mailing list