Only chain to next tunnel if no instructions received. Pass through errors otherwise.
authorMichael Jumper <zhangmaike@users.sourceforge.net>
Sat, 10 Mar 2012 00:00:23 +0000 (16:00 -0800)
committerMichael Jumper <zhangmaike@users.sourceforge.net>
Sat, 10 Mar 2012 00:00:23 +0000 (16:00 -0800)
src/main/resources/tunnel.js

index 835f9f5..3a0a481 100644 (file)
@@ -674,7 +674,16 @@ Guacamole.ChainedTunnel = function() {
 
         // Wrap own oninstruction within current tunnel
         current_tunnel.oninstruction = function(opcode, elements) {
 
         // Wrap own oninstruction within current tunnel
         current_tunnel.oninstruction = function(opcode, elements) {
+            
+            // Invoke handler
             chained_tunnel.oninstruction(opcode, elements);
             chained_tunnel.oninstruction(opcode, elements);
+
+            // Use handler permanently from now on
+            current_tunnel.oninstruction = chained_tunnel.oninstruction;
+
+            // Pass through errors (without trying other tunnels)
+            current_tunnel.onerror = chained_tunnel.onerror;
+            
         }
 
         // Attach next tunnel on error
         }
 
         // Attach next tunnel on error