mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Restored UUID, removed handoff (bad impl), added TODOs
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
|
/* TODO: Make registry thread-safe */
|
||||||
|
|
||||||
guac_client_registry_node* guac_create_client_registry() {
|
guac_client_registry_node* guac_create_client_registry() {
|
||||||
|
|
||||||
@@ -178,7 +178,6 @@ guac_client* __guac_alloc_client(GUACIO* io) {
|
|||||||
/* Init new client */
|
/* Init new client */
|
||||||
client->io = io;
|
client->io = io;
|
||||||
uuid_generate(client->uuid);
|
uuid_generate(client->uuid);
|
||||||
strncpy((char*) client->uuid, "0123456789ABCDEF", 16);
|
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
@@ -225,39 +224,7 @@ guac_client* guac_get_client(int client_fd, guac_client_registry_node* registry,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(instruction.opcode, "handoff") == 0) {
|
/* TODO: implement handoff */
|
||||||
|
|
||||||
fprintf(stderr, "HANDOFF!\n");
|
|
||||||
|
|
||||||
/* Get UUID from instruction */
|
|
||||||
guac_decode_base64_inplace(instruction.argv[0]);
|
|
||||||
|
|
||||||
fprintf(stderr, "Decoded.\n");
|
|
||||||
|
|
||||||
/* Find client associated with UUID*/
|
|
||||||
if (registry) {
|
|
||||||
fprintf(stderr, "Locating.\n");
|
|
||||||
client = guac_find_client(registry, (unsigned char*) "0123456789ABCDEF" /*instruction.argv[0]*/);
|
|
||||||
fprintf(stderr, "@%p\n", (void*) client);
|
|
||||||
|
|
||||||
/* Transfer client I/O to new connection, if client exists */
|
|
||||||
if (client) {
|
|
||||||
|
|
||||||
int fd = client->io->fd;
|
|
||||||
guac_close(client->io);
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
client->io = io;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* TODO: Send error if client not found */
|
|
||||||
|
|
||||||
fprintf(stderr, "OK\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: Send error if handoff sent to client without registry */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user