[Spice-devel] [PATCH spice] Do not discard monitor config messages if agent is disconnected

Marc-André Lureau marcandre.lureau at gmail.com
Mon Apr 7 05:17:24 PDT 2014


VD_AGENT_MONITORS_CONFIG messages can be processed if
red_dispatcher_use_client_monitors_config().

A token must be returned to the client to keep sending agent messages.

This solves reconfiguration of monitor with DRM/KMS device when the
agent is not running.
---
 server/agent-msg-filter.c | 13 +++++--------
 server/reds.c             |  5 +++--
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/server/agent-msg-filter.c b/server/agent-msg-filter.c
index 567e03d..f53fd9a 100644
--- a/server/agent-msg-filter.c
+++ b/server/agent-msg-filter.c
@@ -68,7 +68,11 @@ data_to_read:
         return AGENT_MSG_FILTER_PROTO_ERROR;
     }
 
-    if (filter->discard_all) {
+
+    if (msg_header.type == VD_AGENT_MONITORS_CONFIG &&
+        red_dispatcher_use_client_monitors_config()) {
+        filter->result = AGENT_MSG_FILTER_MONITORS_CONFIG;
+    } else if (filter->discard_all) {
         filter->result = AGENT_MSG_FILTER_DISCARD;
     } else {
         switch (msg_header.type) {
@@ -91,13 +95,6 @@ data_to_read:
                 filter->result = AGENT_MSG_FILTER_DISCARD;
             }
             break;
-        case VD_AGENT_MONITORS_CONFIG:
-            if (red_dispatcher_use_client_monitors_config()) {
-                filter->result = AGENT_MSG_FILTER_MONITORS_CONFIG;
-            } else {
-                filter->result = AGENT_MSG_FILTER_OK;
-            }
-            break;
         default:
             filter->result = AGENT_MSG_FILTER_OK;
         }
diff --git a/server/reds.c b/server/reds.c
index 0390602..c040b63 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1023,10 +1023,11 @@ void reds_on_main_agent_data(MainChannelClient *mcc, void *message, size_t size)
     switch (res) {
     case AGENT_MSG_FILTER_OK:
         break;
-    case AGENT_MSG_FILTER_DISCARD:
-        return;
     case AGENT_MSG_FILTER_MONITORS_CONFIG:
         reds_on_main_agent_monitors_config(mcc, message, size);
+        /* fall through */
+    case AGENT_MSG_FILTER_DISCARD:
+        main_channel_client_push_agent_tokens(mcc, 1);
         return;
     case AGENT_MSG_FILTER_PROTO_ERROR:
         red_channel_client_shutdown(main_channel_client_get_base(mcc));
-- 
1.8.5.3



More information about the Spice-devel mailing list