Maintain SVC list.
This commit is contained in:
parent
4b1c8ec7ff
commit
912cc4d0cf
@ -238,8 +238,9 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
|
||||
guac_rdp_free_svc(svc);
|
||||
}
|
||||
|
||||
/* Log success */
|
||||
/* Store and log on success */
|
||||
else {
|
||||
guac_rdp_add_svc(client, svc);
|
||||
guac_client_log_info(client, "Created static channel \"%s\"...",
|
||||
svc->name);
|
||||
}
|
||||
@ -629,6 +630,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||
guac_client_data->clipboard = NULL;
|
||||
guac_client_data->audio = NULL;
|
||||
guac_client_data->filesystem = NULL;
|
||||
guac_client_data->available_svc = guac_common_list_alloc();
|
||||
|
||||
/* Main socket needs to be threadsafe */
|
||||
guac_socket_require_threadsafe(client->socket);
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "guac_list.h"
|
||||
#include "rdp_fs.h"
|
||||
#include "rdp_keymap.h"
|
||||
#include "rdp_settings.h"
|
||||
@ -160,11 +161,19 @@ typedef struct rdp_guac_client_data {
|
||||
*/
|
||||
guac_rdp_fs* filesystem;
|
||||
|
||||
/**
|
||||
* List of all available static virtual channels.
|
||||
*/
|
||||
guac_common_list* available_svc;
|
||||
|
||||
/**
|
||||
* Lock which is locked and unlocked for each RDP message.
|
||||
*/
|
||||
pthread_mutex_t rdp_lock;
|
||||
|
||||
/**
|
||||
* Common attributes for locks.
|
||||
*/
|
||||
pthread_mutexattr_t attributes;
|
||||
|
||||
} rdp_guac_client_data;
|
||||
|
@ -24,9 +24,11 @@
|
||||
|
||||
#include "client.h"
|
||||
#include "guac_handlers.h"
|
||||
#include "guac_list.h"
|
||||
#include "rdp_cliprdr.h"
|
||||
#include "rdp_keymap.h"
|
||||
#include "rdp_rail.h"
|
||||
#include "rdp_svc.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
@ -66,6 +68,8 @@ int __guac_rdp_send_keysym(guac_client* client, int keysym, int pressed);
|
||||
|
||||
int rdp_guac_client_free_handler(guac_client* client) {
|
||||
|
||||
guac_common_list_element* current;
|
||||
|
||||
rdp_guac_client_data* guac_client_data =
|
||||
(rdp_guac_client_data*) client->data;
|
||||
|
||||
@ -84,6 +88,20 @@ int rdp_guac_client_free_handler(guac_client* client) {
|
||||
if (guac_client_data->filesystem != NULL)
|
||||
guac_rdp_fs_free(guac_client_data->filesystem);
|
||||
|
||||
/* Free any allocated SVCs */
|
||||
current = guac_client_data->available_svc->head;
|
||||
while (current != NULL) {
|
||||
|
||||
guac_common_list_element* next = current->next;
|
||||
|
||||
guac_rdp_free_svc((guac_rdp_svc*) current->data);
|
||||
guac_common_list_remove(guac_client_data->available_svc, current);
|
||||
|
||||
current = next;
|
||||
|
||||
}
|
||||
guac_common_list_free(guac_client_data->available_svc);
|
||||
|
||||
/* Free client data */
|
||||
cairo_surface_destroy(guac_client_data->opaque_glyph_surface);
|
||||
cairo_surface_destroy(guac_client_data->trans_glyph_surface);
|
||||
|
@ -21,6 +21,8 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "client.h"
|
||||
#include "guac_list.h"
|
||||
#include "rdp_svc.h"
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
@ -36,6 +38,7 @@ guac_rdp_svc* guac_rdp_alloc_svc(guac_client* client, char* name) {
|
||||
|
||||
guac_rdp_svc* svc = malloc(sizeof(guac_rdp_svc));
|
||||
|
||||
/* Init SVC */
|
||||
svc->client = client;
|
||||
svc->name = strdup(name);
|
||||
svc->input_pipe = NULL;
|
||||
@ -50,7 +53,14 @@ void guac_rdp_free_svc(guac_rdp_svc* svc) {
|
||||
}
|
||||
|
||||
void guac_rdp_add_svc(guac_client* client, guac_rdp_svc* svc) {
|
||||
/* STUB */
|
||||
|
||||
rdp_guac_client_data* client_data = (rdp_guac_client_data*) client->data;
|
||||
|
||||
/* Add to list of available SVC */
|
||||
guac_common_list_lock(client_data->available_svc);
|
||||
guac_common_list_add(client_data->available_svc, svc);
|
||||
guac_common_list_unlock(client_data->available_svc);
|
||||
|
||||
}
|
||||
|
||||
guac_rdp_svc* guac_rdp_get_svc(guac_client* client, char* name) {
|
||||
@ -58,8 +68,3 @@ guac_rdp_svc* guac_rdp_get_svc(guac_client* client, char* name) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
guac_rdp_svc* guac_rdp_remove_svc(guac_client* client, char* name) {
|
||||
/* STUB */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,7 @@ typedef struct guac_rdp_svc {
|
||||
} guac_rdp_svc;
|
||||
|
||||
/**
|
||||
* Allocate a new SVC with the given name. Not that this will NOT add the
|
||||
* SVC to the list stored in the client.
|
||||
* Allocate a new SVC with the given name.
|
||||
*/
|
||||
guac_rdp_svc* guac_rdp_alloc_svc(guac_client* client, char* name);
|
||||
|
||||
@ -76,7 +75,7 @@ guac_rdp_svc* guac_rdp_alloc_svc(guac_client* client, char* name);
|
||||
void guac_rdp_free_svc(guac_rdp_svc* svc);
|
||||
|
||||
/**
|
||||
* Add the given SVC to the list stored in the client.
|
||||
* Add the given SVC to the list of all available SVCs.
|
||||
*/
|
||||
void guac_rdp_add_svc(guac_client* client, guac_rdp_svc* svc);
|
||||
|
||||
@ -85,10 +84,5 @@ void guac_rdp_add_svc(guac_client* client, guac_rdp_svc* svc);
|
||||
*/
|
||||
guac_rdp_svc* guac_rdp_get_svc(guac_client* client, char* name);
|
||||
|
||||
/**
|
||||
* Remove the SVC with the given name from the list stored in the client.
|
||||
*/
|
||||
guac_rdp_svc* guac_rdp_remove_svc(guac_client* client, char* name);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user