mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
Client now handles tunnel errors.
This commit is contained in:
@@ -44,6 +44,11 @@ Guacamole.Client = function(display, tunnel) {
|
||||
|
||||
tunnel.oninstruction = doInstruction;
|
||||
|
||||
tunnel.onerror = function(message) {
|
||||
if (guac_client.onerror)
|
||||
guac_client.onerror(message);
|
||||
};
|
||||
|
||||
// Display must be relatively positioned for mouse to be handled properly
|
||||
display.style.position = "relative";
|
||||
|
||||
|
@@ -169,8 +169,8 @@ Guacamole.HTTPTunnel = function(tunnelURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Start next request as soon as possible
|
||||
if (xmlhttprequest.readyState >= 2 && nextRequest == null)
|
||||
// Start next request as soon as possible IF request was successful
|
||||
if (xmlhttprequest.readyState >= 2 && nextRequest == null && xmlhttprequest.status == 200)
|
||||
nextRequest = makeRequest();
|
||||
|
||||
// Parse stream when data is received and when complete.
|
||||
@@ -185,8 +185,14 @@ Guacamole.HTTPTunnel = function(tunnelURL) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
|
||||
// If canceled, stop transfer
|
||||
if (xmlhttprequest.status == 0) {
|
||||
tunnel.disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
// Halt on error during request
|
||||
if (xmlhttprequest.status == 0 || xmlhttprequest.status != 200) {
|
||||
else if (xmlhttprequest.status != 200) {
|
||||
|
||||
// Get error message (if any)
|
||||
var message = xmlhttprequest.getResponseHeader("X-Guacamole-Error-Message");
|
||||
|
Reference in New Issue
Block a user