server: proxy: proxy rdp heartbeats
authorKobi Mizrachi <kmizrachi18@gmail.com>
Tue, 7 Jul 2020 07:16:46 +0000 (10:16 +0300)
committerakallabeth <akallabeth@posteo.net>
Tue, 7 Jul 2020 07:59:41 +0000 (09:59 +0200)
(cherry picked from commit 659e4c772bbc7e3807dc94628934e8982f8efcf7)

server/proxy/pf_client.c

index 0db33f8..4f6d00c 100644 (file)
@@ -156,12 +156,6 @@ static BOOL pf_client_use_peer_load_balance_info(pClientContext* pc)
        return TRUE;
 }
 
-/**
- * Called before a connection is established.
- *
- * TODO: Take client to proxy settings and use channel whitelist to filter out
- * unwanted channels.
- */
 static BOOL pf_client_pre_connect(freerdp* instance)
 {
        pClientContext* pc = (pClientContext*)instance->context;
@@ -273,6 +267,13 @@ static BOOL pf_client_receive_channel_data_hook(freerdp* instance, UINT16 channe
        return client_receive_channel_data_original(instance, channelId, data, size, flags, totalSize);
 }
 
+static BOOL pf_client_on_server_heartbeat(freerdp* instance, BYTE period, BYTE count1, BYTE count2)
+{
+       pClientContext* pc = (pClientContext*)instance->context;
+       pServerContext* ps = pc->pdata->ps;
+       return freerdp_heartbeat_send_heartbeat_pdu(ps->context.peer, period, count1, count2);
+}
+
 /**
  * Called after a RDP connection was successfully established.
  * Settings might have changed during negotiation of client / server feature
@@ -348,6 +349,8 @@ static BOOL pf_client_post_connect(freerdp* instance)
                }
        }
 
+       instance->heartbeat->ServerHeartbeat = pf_client_on_server_heartbeat;
+
        /*
         * after the connection fully established and settings were negotiated with target server,
         * send a reactivation sequence to the client with the negotiated settings. This way,