[Spice-devel] [PATCH spice-streaming-agent 6/6] Stub to handle errors from server

Frediano Ziglio fziglio at redhat.com
Mon Feb 19 15:52:43 UTC 2018


Base error message handling.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/spice-streaming-agent.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 5813fba..2612ccb 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -82,6 +82,7 @@ static int have_something_to_read(int timeout)
 
 static int read_stream_capabilities(uint32_t len);
 static int read_stream_start_stop(uint32_t len);
+static int read_stream_error(uint32_t len);
 
 static int read_command_from_device(void)
 {
@@ -101,6 +102,8 @@ static int read_command_from_device(void)
     switch (hdr.type) {
     case STREAM_TYPE_CAPABILITIES:
         return read_stream_capabilities(hdr.size);
+    case STREAM_TYPE_NOTIFY_ERROR:
+        return read_stream_error(hdr.size);
     case STREAM_TYPE_START_STOP:
         return read_stream_start_stop(hdr.size);
     }
@@ -152,6 +155,13 @@ static int read_stream_capabilities(uint32_t len)
     return 1;
 }
 
+static int read_stream_error(uint32_t len)
+{
+    // TODO read message and use it
+    ERROR("got an error message from server");
+    return -1;
+}
+
 static int read_command(bool blocking)
 {
     int timeout = blocking?-1:0;
-- 
2.14.3



More information about the Spice-devel mailing list