[gnome-remote-desktop] session-rdp: Add API to notify a severe error



commit efe8d3aa8aa0af2e82ef0836298a7b6d5d567457
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Sat Mar 20 17:27:08 2021 +0100

    session-rdp: Add API to notify a severe error
    
    The capability, that indicates the support for the graphics pipeline
    for the client or the server, is already exchanged upon connection of
    the RDP client.
    If the client indicates support for the graphics pipeline, but actually
    does not support it (opening the graphics pipeline fails), then the
    client heavily violates the protocol.
    In the future, gnome-remote-desktop might also require the graphics
    pipeline for specific use cases, like headless sessions or RAIL, as
    some actions like submitting alpha channel data (usually, when using
    RAIL), submitting the monitor configuration to the client, handling
    network latency can only be (easily) done with the graphics pipeline.
    
    Additionally, if the client tries to reset the graphics pipeline with
    a new capability exchange (CapsAdvertise), but is not allowed to, or
    submits capability sets, that are unsupported by gnome-remote-desktop,
    then gnome-remote-desktop needs to get rid of the client.
    
    So, add an API for this use case. Normally, these severe situations
    should not happen, but gnome-remote-desktop needs to be able to handle
    them if they happen.

 src/grd-session-rdp.c | 11 +++++++++++
 src/grd-session-rdp.h |  3 +++
 2 files changed, 14 insertions(+)
---
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index d910ff1..e0916c2 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -83,6 +83,7 @@ struct _GrdSessionRdp
 
   GSocketConnection *connection;
   freerdp_peer *peer;
+  uint32_t rdp_error_info;
 
   GThread *socket_thread;
   HANDLE start_event;
@@ -571,6 +572,16 @@ maybe_queue_close_session_idle (GrdSessionRdp *session_rdp)
   SetEvent (session_rdp->stop_event);
 }
 
+void
+grd_session_rdp_notify_error (GrdSessionRdp *session_rdp,
+                              uint32_t       error_info)
+{
+  session_rdp->rdp_error_info = error_info;
+
+  unset_rdp_peer_flag (session_rdp, RDP_PEER_ACTIVATED);
+  maybe_queue_close_session_idle (session_rdp);
+}
+
 static void
 handle_client_gone (GrdSessionRdp *session_rdp)
 {
diff --git a/src/grd-session-rdp.h b/src/grd-session-rdp.h
index 64c4a5b..2781d8c 100644
--- a/src/grd-session-rdp.h
+++ b/src/grd-session-rdp.h
@@ -35,6 +35,9 @@ G_DECLARE_FINAL_TYPE (GrdSessionRdp,
 GrdSessionRdp *grd_session_rdp_new (GrdRdpServer      *rdp_server,
                                     GSocketConnection *connection);
 
+void grd_session_rdp_notify_error (GrdSessionRdp *session_rdp,
+                                   uint32_t       error_info);
+
 int grd_session_rdp_get_stride_for_width (GrdSessionRdp *session_rdp,
                                           int            width);
 


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