GUAC-556: Use guac_client_abort() for VNC errors. Use appropriate error codes.

This commit is contained in:
Michael Jumper 2014-03-22 14:51:21 -07:00
parent 22b2618562
commit 81d7731e8a
2 changed files with 4 additions and 9 deletions

View File

@ -205,10 +205,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/*** PARSE ARGUMENTS ***/
if (argc != VNC_ARGS_COUNT) {
guac_protocol_send_error(client->socket,
"Wrong argument count received.",
GUAC_PROTOCOL_STATUS_CLIENT_BAD_REQUEST);
guac_socket_flush(client->socket);
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR, "Wrong argument count received.");
return 1;
}
@ -291,9 +288,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* If the final connect attempt fails, return error */
if (!rfb_client) {
guac_protocol_send_error(client->socket,
"Error initializing VNC client",
GUAC_PROTOCOL_STATUS_SERVER_ERROR);
guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR, "Unable to connect to VNC server.");
guac_socket_flush(client->socket);
return 1;
}

View File

@ -51,7 +51,7 @@ int vnc_guac_client_handle_messages(guac_client* client) {
/* Handle any message received */
if (!HandleRFBServerMessage(rfb_client)) {
guac_client_log_error(client, "Error handling VNC server message\n");
guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR, "Error handling message from VNC server.");
return 1;
}
@ -70,7 +70,7 @@ int vnc_guac_client_handle_messages(guac_client* client) {
/* If an error occurs, log it and fail */
if (wait_result < 0) {
guac_client_log_error(client, "Error waiting for VNC server message\n");
guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR, "Connection closed.");
return 1;
}