More error handling, style fix.
This commit is contained in:
parent
6300c7c56a
commit
71d59845e9
@ -190,9 +190,14 @@ guac_client* guac_get_client(int client_fd) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send args */
|
if ( /* Send args */
|
||||||
guac_send_args(io, client_args);
|
guac_send_args(io, client_args)
|
||||||
guac_flush(io);
|
|| guac_flush(io)
|
||||||
|
) {
|
||||||
|
guac_close(io);
|
||||||
|
guac_free_instruction_data(&instruction);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
guac_free_instruction_data(&instruction);
|
guac_free_instruction_data(&instruction);
|
||||||
break;
|
break;
|
||||||
@ -292,8 +297,13 @@ void* __guac_client_output_thread(void* data) {
|
|||||||
long timestamp = guac_current_timestamp();
|
long timestamp = guac_current_timestamp();
|
||||||
if (timestamp - client->last_sent_timestamp > GUAC_SYNC_FREQUENCY) {
|
if (timestamp - client->last_sent_timestamp > GUAC_SYNC_FREQUENCY) {
|
||||||
client->last_sent_timestamp = timestamp;
|
client->last_sent_timestamp = timestamp;
|
||||||
guac_send_sync(io, timestamp);
|
if (
|
||||||
guac_flush(io);
|
guac_send_sync(io, timestamp)
|
||||||
|
|| guac_flush(io)
|
||||||
|
) {
|
||||||
|
guac_client_stop(client);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle server messages */
|
/* Handle server messages */
|
||||||
@ -320,11 +330,18 @@ void* __guac_client_output_thread(void* data) {
|
|||||||
|
|
||||||
/* Send sync instruction */
|
/* Send sync instruction */
|
||||||
client->last_sent_timestamp = guac_current_timestamp();
|
client->last_sent_timestamp = guac_current_timestamp();
|
||||||
guac_send_sync(io, client->last_sent_timestamp);
|
if (guac_send_sync(io, client->last_sent_timestamp)) {
|
||||||
|
guac_client_stop(client);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
guac_flush(io);
|
if (guac_flush(io)) {
|
||||||
|
guac_client_stop(client);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If sync threshold exceeded, don't spin waiting for resync */
|
/* If sync threshold exceeded, don't spin waiting for resync */
|
||||||
|
@ -214,7 +214,7 @@ int guac_send_name(GUACIO* io, const char* name) {
|
|||||||
int guac_send_size(GUACIO* io, int w, int h) {
|
int guac_send_size(GUACIO* io, int w, int h) {
|
||||||
|
|
||||||
return
|
return
|
||||||
guac_write_string(io, "size:")
|
guac_write_string(io, "size:")
|
||||||
|| guac_write_int(io, w)
|
|| guac_write_int(io, w)
|
||||||
|| guac_write_string(io, ",")
|
|| guac_write_string(io, ",")
|
||||||
|| guac_write_int(io, h)
|
|| guac_write_int(io, h)
|
||||||
@ -227,7 +227,7 @@ int guac_send_clipboard(GUACIO* io, const char* data) {
|
|||||||
char* escaped = guac_escape_string(data);
|
char* escaped = guac_escape_string(data);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
guac_write_string(io, "clipboard:")
|
guac_write_string(io, "clipboard:")
|
||||||
|| guac_write_string(io, escaped)
|
|| guac_write_string(io, escaped)
|
||||||
|| guac_write_string(io, ";")
|
|| guac_write_string(io, ";")
|
||||||
) {
|
) {
|
||||||
@ -245,7 +245,7 @@ int guac_send_error(GUACIO* io, const char* error) {
|
|||||||
char* escaped = guac_escape_string(error);
|
char* escaped = guac_escape_string(error);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
guac_write_string(io, "error:")
|
guac_write_string(io, "error:")
|
||||||
|| guac_write_string(io, escaped)
|
|| guac_write_string(io, escaped)
|
||||||
|| guac_write_string(io, ";")
|
|| guac_write_string(io, ";")
|
||||||
) {
|
) {
|
||||||
@ -261,7 +261,7 @@ int guac_send_error(GUACIO* io, const char* error) {
|
|||||||
int guac_send_sync(GUACIO* io, long timestamp) {
|
int guac_send_sync(GUACIO* io, long timestamp) {
|
||||||
|
|
||||||
return
|
return
|
||||||
guac_write_string(io, "sync:")
|
guac_write_string(io, "sync:")
|
||||||
|| guac_write_int(io, timestamp)
|
|| guac_write_int(io, timestamp)
|
||||||
|| guac_write_string(io, ";");
|
|| guac_write_string(io, ";");
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ int guac_send_sync(GUACIO* io, long timestamp) {
|
|||||||
int guac_send_copy(GUACIO* io, int srcl, int srcx, int srcy, int w, int h, int dstl, int dstx, int dsty) {
|
int guac_send_copy(GUACIO* io, int srcl, int srcx, int srcy, int w, int h, int dstl, int dstx, int dsty) {
|
||||||
|
|
||||||
return
|
return
|
||||||
guac_write_string(io, "copy:")
|
guac_write_string(io, "copy:")
|
||||||
|| guac_write_int(io, srcl)
|
|| guac_write_int(io, srcl)
|
||||||
|| guac_write_string(io, ",")
|
|| guac_write_string(io, ",")
|
||||||
|| guac_write_int(io, srcx)
|
|| guac_write_int(io, srcx)
|
||||||
@ -419,7 +419,7 @@ int guac_send_cursor(GUACIO* io, int x, int y, png_byte** png_rows, int w, int h
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
guac_write_string(io, "cursor:")
|
guac_write_string(io, "cursor:")
|
||||||
|| guac_write_int(io, x)
|
|| guac_write_int(io, x)
|
||||||
|| guac_write_string(io, ",")
|
|| guac_write_string(io, ",")
|
||||||
|| guac_write_int(io, y)
|
|| guac_write_int(io, y)
|
||||||
|
Loading…
Reference in New Issue
Block a user