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

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

 



Base error message handling.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]