[gnome-remote-desktop/gnome-42] session-rdp: Handle queued bandwidth measure stop operations



commit 3d59fdfa2b23ba06116f92b1673203a9bded3f94
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Tue May 17 12:24:58 2022 +0200

    session-rdp: Handle queued bandwidth measure stop operations
    
    The socket thread, where channel messages, including graphics updates
    via the graphics pipeline,  are sent to the client, needs to take care
    of sending queued Bandwidth Measure Stop PDUs.
    To do this, use the previously implemented APIs to retrieve the event
    handle for queued updated and the API to actually send the Bandwidth
    Measure Stop PDU.

 src/grd-session-rdp.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index 1260216d..e9b5fe9f 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -2011,9 +2011,20 @@ socket_thread_func (gpointer data)
 
   while (TRUE)
     {
+      GrdRdpNetworkAutodetection *network_autodetection =
+        rdp_peer_context->network_autodetection;
+      gboolean pending_bw_measure_stop = FALSE;
+      HANDLE bw_measure_stop_event = NULL;
+
       n_events = 0;
 
       events[n_events++] = session_rdp->stop_event;
+      if (network_autodetection)
+        {
+          bw_measure_stop_event =
+            grd_rdp_network_autodetection_get_bw_measure_stop_event_handle (network_autodetection);
+          events[n_events++] = bw_measure_stop_event;
+        }
 
       n_freerdp_handles = peer->GetEventHandles (peer, &events[n_events],
                                                  32 - n_events);
@@ -2068,6 +2079,12 @@ socket_thread_func (gpointer data)
             break;
         }
 
+      if (bw_measure_stop_event)
+        {
+          pending_bw_measure_stop = WaitForSingleObject (bw_measure_stop_event,
+                                                         0) == WAIT_OBJECT_0;
+        }
+
       if (WaitForSingleObject (channel_event, 0) == WAIT_OBJECT_0 &&
           !WTSVirtualChannelManagerCheckFileDescriptor (vcm))
         {
@@ -2075,6 +2092,9 @@ socket_thread_func (gpointer data)
           handle_client_gone (session_rdp);
           break;
         }
+
+      if (pending_bw_measure_stop)
+        grd_rdp_network_autodetection_bw_measure_stop (network_autodetection);
     }
 
   if (session_rdp->hwaccel_nvidia)


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