Add support for NOP.
This commit is contained in:
parent
8a8ad23312
commit
4ebafa0482
@ -74,17 +74,17 @@ void* __guacd_client_output_thread(void* data) {
|
||||
/* Guacamole client output loop */
|
||||
while (client->state == GUAC_CLIENT_RUNNING) {
|
||||
|
||||
/* Occasionally ping client with repeat of last sync */
|
||||
/* Occasionally send client NOP keep-alive */
|
||||
guac_timestamp timestamp = guac_timestamp_current();
|
||||
if (timestamp - last_ping_timestamp > GUACD_SYNC_FREQUENCY) {
|
||||
|
||||
/* Record time of last synnc */
|
||||
last_ping_timestamp = timestamp;
|
||||
|
||||
/* Send sync */
|
||||
if (guac_protocol_send_sync(socket, client->last_sent_timestamp)) {
|
||||
/* Send NOP */
|
||||
if (guac_protocol_send_nop(socket)) {
|
||||
guacd_client_log_guac_error(client,
|
||||
"Error sending \"sync\" instruction");
|
||||
"Error sending \"nop\" keep-alive");
|
||||
guac_client_stop(client);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -232,6 +232,18 @@ int guac_protocol_send_error(guac_socket* socket, const char* error);
|
||||
int guac_protocol_send_nest(guac_socket* socket, int index,
|
||||
const char* data);
|
||||
|
||||
/**
|
||||
* Sends a nop instruction (null-operation) over the given guac_socket
|
||||
* connection.
|
||||
*
|
||||
* If an error occurs sending the instruction, a non-zero value is
|
||||
* returned, and guac_error is set appropriately.
|
||||
*
|
||||
* @param socket The guac_socket connection to use.
|
||||
* @return Zero on success, non-zero on error.
|
||||
*/
|
||||
int guac_protocol_send_nop(guac_socket* socket);
|
||||
|
||||
/**
|
||||
* Sends a set instruction over the given guac_socket connection.
|
||||
*
|
||||
|
@ -951,6 +951,18 @@ int guac_protocol_send_nest(guac_socket* socket, int index,
|
||||
|
||||
}
|
||||
|
||||
int guac_protocol_send_nop(guac_socket* socket) {
|
||||
|
||||
int ret_val;
|
||||
|
||||
guac_socket_instruction_begin(socket);
|
||||
ret_val = guac_socket_write_string(socket, "3.nop;");
|
||||
guac_socket_instruction_end(socket);
|
||||
|
||||
return ret_val;
|
||||
|
||||
}
|
||||
|
||||
int guac_protocol_send_png(guac_socket* socket, guac_composite_mode mode,
|
||||
const guac_layer* layer, int x, int y, cairo_surface_t* surface) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user