GUAC-1389: Ensure users that join after a SVC has connected are alerted to its existence.

This commit is contained in:
Michael Jumper 2016-03-04 15:09:42 -08:00
parent 9191e264f8
commit 8ca77c1c78
4 changed files with 58 additions and 2 deletions

View File

@ -97,8 +97,9 @@ void guac_svc_process_connect(rdpSvcPlugin* plugin) {
/* Create pipe */ /* Create pipe */
svc->output_pipe = guac_client_alloc_stream(svc->client); svc->output_pipe = guac_client_alloc_stream(svc->client);
guac_protocol_send_pipe(svc->client->socket, svc->output_pipe,
"application/octet-stream", svc->name); /* Notify of pipe's existence */
guac_rdp_svc_send_pipe(svc->client->socket, svc);
/* Log connection to static channel */ /* Log connection to static channel */
guac_client_log(svc->client, GUAC_LOG_INFO, guac_client_log(svc->client, GUAC_LOG_INFO,

View File

@ -65,6 +65,32 @@ void guac_rdp_free_svc(guac_rdp_svc* svc) {
free(svc); free(svc);
} }
void guac_rdp_svc_send_pipe(guac_socket* socket, guac_rdp_svc* svc) {
/* Send pipe instruction for the SVC's output stream */
guac_protocol_send_pipe(socket, svc->output_pipe,
"application/octet-stream", svc->name);
}
void guac_rdp_svc_send_pipes(guac_user* user) {
guac_client* client = user->client;
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
guac_common_list_lock(rdp_client->available_svc);
/* Send pipe for each allocated SVC's output stream */
guac_common_list_element* current = rdp_client->available_svc->head;
while (current != NULL) {
guac_rdp_svc_send_pipe(user->socket, (guac_rdp_svc*) current->data);
current = current->next;
}
guac_common_list_unlock(rdp_client->available_svc);
}
void guac_rdp_add_svc(guac_client* client, guac_rdp_svc* svc) { void guac_rdp_add_svc(guac_client* client, guac_rdp_svc* svc) {
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;

View File

@ -79,6 +79,31 @@ guac_rdp_svc* guac_rdp_alloc_svc(guac_client* client, char* name);
*/ */
void guac_rdp_free_svc(guac_rdp_svc* svc); void guac_rdp_free_svc(guac_rdp_svc* svc);
/**
* Sends the "pipe" instruction describing the given static virtual channel
* along the given socket. This pipe instruction will relate the SVC's
* underlying output stream with the SVC's name and the mimetype
* "application/octet-stream".
*
* @param socket
* The socket along which the "pipe" instruction should be sent.
*
* @param svc
* The static virtual channel that the "pipe" instruction should describe.
*/
void guac_rdp_svc_send_pipe(guac_socket* socket, guac_rdp_svc* svc);
/**
* Sends the "pipe" instructions describing all static virtual channels
* available to the given user along that user's socket. Each pipe instruction
* will relate the associated SVC's underlying output stream with the SVC's
* name and the mimetype "application/octet-stream".
*
* @param user
* The user to send the "pipe" instructions to.
*/
void guac_rdp_svc_send_pipes(guac_user* user);
/** /**
* Add the given SVC to the list of all available SVCs. * Add the given SVC to the list of all available SVCs.
* *

View File

@ -28,6 +28,7 @@
#include "rdp.h" #include "rdp.h"
#include "rdp_settings.h" #include "rdp_settings.h"
#include "rdp_stream.h" #include "rdp_stream.h"
#include "rdp_svc.h"
#ifdef ENABLE_COMMON_SSH #ifdef ENABLE_COMMON_SSH
#include "sftp.h" #include "sftp.h"
@ -76,6 +77,9 @@ int guac_rdp_user_join_handler(guac_user* user, int argc, char** argv) {
if (rdp_client->audio) if (rdp_client->audio)
guac_audio_stream_add_user(rdp_client->audio, user); guac_audio_stream_add_user(rdp_client->audio, user);
/* Bring user up to date with any registered static channels */
guac_rdp_svc_send_pipes(user);
/* Synchronize with current display */ /* Synchronize with current display */
guac_common_display_dup(rdp_client->display, user, user->socket); guac_common_display_dup(rdp_client->display, user, user->socket);
guac_socket_flush(user->socket); guac_socket_flush(user->socket);