Support for "ready" message (both client and server)
This commit is contained in:
parent
455c340318
commit
859e739dae
@ -123,6 +123,20 @@ void guac_send_name(GUACIO* io, const char* name);
|
|||||||
*/
|
*/
|
||||||
void guac_send_error(GUACIO* io, const char* error);
|
void guac_send_error(GUACIO* io, const char* error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a ready instruction over the given GUACIO connection. The
|
||||||
|
* ready instruction merely signals the client that its ready
|
||||||
|
* instruction has been handled. The ready exchange is intended to
|
||||||
|
* synchronize instruction handling (if needed) and serve as a health
|
||||||
|
* indicator for both client and server.
|
||||||
|
*
|
||||||
|
* Normally, this functino 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
|
* Sends a clipboard instruction over the given GUACIO connection. The
|
||||||
* clipboard data given will be automatically escaped for transmission.
|
* clipboard data given will be automatically escaped for transmission.
|
||||||
|
@ -236,18 +236,6 @@ void guac_start_client(guac_client* client) {
|
|||||||
/* VNC Client Loop */
|
/* VNC Client Loop */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
/* Handle server messages */
|
|
||||||
if (client->handle_messages) {
|
|
||||||
|
|
||||||
int retval = client->handle_messages(client);
|
|
||||||
if (retval) {
|
|
||||||
syslog(LOG_ERR, "Error handling server messages");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
guac_flush(io);
|
|
||||||
}
|
|
||||||
|
|
||||||
wait_result = guac_instructions_waiting(io);
|
wait_result = guac_instructions_waiting(io);
|
||||||
if (wait_result > 0) {
|
if (wait_result > 0) {
|
||||||
|
|
||||||
@ -258,7 +246,25 @@ void guac_start_client(guac_client* client) {
|
|||||||
|
|
||||||
do {
|
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) {
|
||||||
|
syslog(LOG_ERR, "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)
|
||||||
if (
|
if (
|
||||||
client->mouse_handler(
|
client->mouse_handler(
|
||||||
|
@ -175,6 +175,10 @@ void guac_send_size(GUACIO* io, int w, int h) {
|
|||||||
guac_write_string(io, ";");
|
guac_write_string(io, ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void guac_send_ready(GUACIO* io) {
|
||||||
|
guac_write_string(io, "ready;");
|
||||||
|
}
|
||||||
|
|
||||||
void guac_send_clipboard(GUACIO* io, const char* data) {
|
void guac_send_clipboard(GUACIO* io, const char* data) {
|
||||||
|
|
||||||
char* escaped = guac_escape_string(data);
|
char* escaped = guac_escape_string(data);
|
||||||
|
Loading…
Reference in New Issue
Block a user