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

Frediano Ziglio fziglio at redhat.com
Tue Feb 20 14:30:29 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 9547e49..7ad8c42 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -81,6 +81,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);
     }
@@ -155,6 +158,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
+    throw std::runtime_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