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

[virt-tools-list] [PATCH virt-viewer] spice: handle switch-host event



Do not disconnect session when switching host (non-seamless migration
method).

Also, handle a bit better main channel events and do not disconnect on
unknown events, however raise unhandled event message to warning
level.
---
 src/virt-viewer-session-spice.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 3a2bd6f..c000d35 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -307,9 +307,8 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
         if (self->priv->session)
             spice_session_disconnect(self->priv->session);
         break;
-    case SPICE_CHANNEL_ERROR_CONNECT:
-        DEBUG_LOG("main channel: failed to connect");
-        g_signal_emit_by_name(session, "session-disconnected");
+    case SPICE_CHANNEL_SWITCHING:
+        DEBUG_LOG("main channel: switching host");
         break;
     case SPICE_CHANNEL_ERROR_AUTH:
         DEBUG_LOG("main channel: auth failure (wrong password?)");
@@ -331,10 +330,18 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
                 spice_session_connect(self->priv->session);
         }
         break;
-    default:
-        g_message("unhandled spice main channel event: %d", event);
+    case SPICE_CHANNEL_ERROR_CONNECT:
+        DEBUG_LOG("main channel: failed to connect");
+        g_signal_emit_by_name(session, "session-disconnected");
+        break;
+    case SPICE_CHANNEL_ERROR_IO:
+    case SPICE_CHANNEL_ERROR_LINK:
+    case SPICE_CHANNEL_ERROR_TLS:
         g_signal_emit_by_name(session, "session-disconnected");
         break;
+    default:
+        g_warning("unhandled spice main channel event: %d", event);
+        break;
     }
 
     g_free(password);
@@ -435,7 +442,7 @@ virt_viewer_session_spice_channel_new(SpiceSession *s,
 
         g_signal_emit_by_name(session, "session-connected");
 
-        DEBUG_LOG("new session channel (#%d)", id);
+        DEBUG_LOG("new display channel (#%d)", id);
         display = virt_viewer_display_spice_new(self,
                                                 channel,
                                                 spice_display_new(s, id));
-- 
1.7.7.6


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