Reinstated ready instruction

This commit is contained in:
Michael Jumper 2011-03-05 14:47:02 -08:00
parent cd4205caf6
commit 47762889cf
3 changed files with 41 additions and 15 deletions

View File

@ -141,6 +141,19 @@ void guac_send_name(GUACIO* io, const char* name);
*/
void guac_send_error(GUACIO* io, const char* error);
/**
* Sends a ready instruction over the given GUACIO connection. The
* ready instruction signals the client that the proxy is ready to
* handle server messages, and thus is ready to handle the client's
* ready message.
*
* Normally, this function should not be called by client plugins,
* as the ready instruction will be handled automatically.
*
* @param io The GUACIO connection to use.
*/
void guac_send_ready(GUACIO* io);
/**
* Sends a clipboard instruction over the given GUACIO connection. The
* clipboard data given will be automatically escaped for transmission.

View File

@ -213,6 +213,11 @@ guac_client* guac_get_client(int client_fd) {
}
guac_free_instruction_data(&instruction);
/* Send ready message */
guac_send_ready(io);
guac_flush(io);
return client;
} /* end if connect */
@ -249,22 +254,9 @@ void guac_start_client(guac_client* client) {
guac_instruction instruction;
int wait_result;
/* VNC Client Loop */
/* Client loop */
for (;;) {
/* Handle server messages */
if (client->handle_messages) {
int retval = client->handle_messages(client);
if (retval) {
GUAC_LOG_ERROR("Error handling server messages");
return;
}
guac_flush(io);
}
wait_result = guac_instructions_waiting(io);
if (wait_result > 0) {
@ -275,7 +267,24 @@ void guac_start_client(guac_client* client) {
do {
if (strcmp(instruction.opcode, "mouse") == 0) {
if (strcmp(instruction.opcode, "ready") == 0) {
/* Handle server messages */
if (client->handle_messages) {
int retval = client->handle_messages(client);
if (retval) {
GUAC_LOG_ERROR("Error handling server messages");
return;
}
guac_send_ready(io);
guac_flush(io);
}
}
else if (strcmp(instruction.opcode, "mouse") == 0) {
if (client->mouse_handler)
if (
client->mouse_handler(

View File

@ -226,6 +226,10 @@ void guac_send_error(GUACIO* io, const char* error) {
}
void guac_send_ready(GUACIO* io) {
guac_write_string(io, "ready;");
}
void guac_send_copy(GUACIO* io, int srcl, int srcx, int srcy, int w, int h, int dstl, int dstx, int dsty) {
guac_write_string(io, "copy:");
guac_write_int(io, srcl);