Skip to content

Commit

Permalink
Reconnect terminal if websocket was closed
Browse files Browse the repository at this point in the history
Fixes #1844

If the websocket was closed (seeing this happen in container scenarios), mark the terminal as disconnected so the reconnection logic kicks in. For example, terminal should reconnect if the user types in the disconnected terminal.

Prior to this fix, the terminal would remain inactive and ignore input if the underlying websocket had closed.
  • Loading branch information
gtritchie committed Dec 15, 2017
1 parent 3fac347 commit 9c30d9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Expand Up @@ -265,7 +265,13 @@ public void receivedOutput(String output)
}
socket_.dispatchOutput(output, doLocalEcho());
}


@Override
public void connectionDisconnected()
{
disconnect(false);
}

public void receivedSendToTerminal(String input)
{
// tweak line endings
Expand Down
Expand Up @@ -60,6 +60,11 @@ public interface Session
* @param output output from server
*/
void receivedOutput(String output);

/**
* Called to disconnect the terminal
*/
void connectionDisconnected();
}

public interface ConnectCallback
Expand Down Expand Up @@ -237,6 +242,7 @@ public void onClose(CloseEvent event)
{
diagnostic("WebSocket closed");
socket_ = null;
session_.connectionDisconnected();
}

@Override
Expand Down

0 comments on commit 9c30d9f

Please sign in to comment.