closes #9274
[arvados.git] / apps / workbench / public / webshell / shell_in_a_box.js
index 6fdf10d7215491d58a64c6176860e26adfbca15c..0c7e800ef8e71aa308fb8d2af6f51b0498d0e8ac 100644 (file)
@@ -134,7 +134,9 @@ ShellInABox.prototype.sessionClosed = function() {
       }
       this.vt100('Session closed.');
     }
-    this.showReconnect(true);
+    // Revealing the "reconnect" button is commented out until we hook
+    // up the username+token auto-login mechanism to the new session:
+    //this.showReconnect(true);
   } catch (e) {
   }
 };
@@ -185,6 +187,7 @@ ShellInABox.prototype.sendRequest = function(request) {
              }
            }
     }(this);
+  ShellInABox.lastRequestSent = Date.now();
   request.send(content);
 };
 
@@ -205,8 +208,13 @@ ShellInABox.prototype.onReadyStateChange = function(request) {
         this.sendRequest(request);
       }
     } else if (request.status == 0) {
-      // Time Out
-      this.sendRequest(request);
+        if (ShellInABox.lastRequestSent + 2000 < Date.now()) {
+            // Timeout, try again
+            this.sendRequest(request);
+        } else {
+            this.vt100('\r\n\r\nRequest failed.');
+            this.sessionClosed();
+        }
     } else {
       this.sessionClosed();
     }