[gnome-remote-desktop] session-rdp: Send Provider Ultimatum on server sided disconnection



commit 9a05c2a024cf530a57fa0410cacbe3eadb12bf9c
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Sun Jan 3 23:45:57 2021 +0100

    session-rdp: Send Provider Ultimatum on server sided disconnection
    
    Currently, when the remote desktop connection is stopped via g-s, g-r-d
    doesn't notify the client about the reason of the disconnection.
    This leaves the remote desktop client in the dark, as it is unable to
    handle this situation properly, as it doesn't simply know the cause of
    the disconnection.
    For example, if the client has auto-reconnection enabled, it will try
    to reconnect to g-r-d again on a server sided disconnection even though
    the user might have triggered the disconnection by himself via g-s.
    
    Unfortunately, mutter (currently) doesn't provide a reason when the
    remote desktop connection was stopped via g-s, so for now always tell
    the remote desktop client that the connection was dropped by an
    administrator or an administrative tool.

 src/grd-session-rdp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index d144a8e..d8d2460 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -1651,10 +1651,17 @@ grd_session_rdp_stop (GrdSession *session)
 
   g_debug ("Stopping RDP session");
 
-  SetEvent (session_rdp->stop_event);
+  if (WaitForSingleObject (session_rdp->stop_event, 0) == WAIT_TIMEOUT)
+    {
+      freerdp_set_error_info (peer->context->rdp,
+                              ERRINFO_RPC_INITIATED_DISCONNECT);
+
+      SetEvent (session_rdp->stop_event);
+    }
 
   g_clear_object (&session_rdp->pipewire_stream);
 
+  peer->Close (peer);
   g_clear_pointer (&session_rdp->socket_thread, g_thread_join);
   g_clear_object (&session_rdp->connection);
 


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