wassh: fix showing popup on disconnection when using relay by returning error when writing to a closed relay socket

When the ssh connection drops in nassh, pressing any key will show the "Process exited" dialog, with options to reconnect or exit.

This works on NaCL, and on wassh with direct connections, but not with relays: pressing keys after the connection drops does nothing.

Listen for the disconnection event from the relay stream, and manually force a connection reset error on subsequent writes.

Screenshot: https://drive.google.com/file/d/1hJxEQzKab10rwCFtqDJ4jTO46mB2Ud6r/view?usp=sharing

I connected to my computer via a websockify relay, then force closed the sshd to terminate the connection.
Pressing a key then shows the "Process exited" dialog, like what happens without a relay / what happens in NaCL.

Change-Id: I181543b8687bf6c208a2603904aea032999df0af
Reviewed-on: https://chromium-review.googlesource.com/c/apps/libapps/+/6027492
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Joel Hockey <joelhockey@chromium.org>
1 file changed
tree: 79d8e6cdec4f4d2116216b9832830dea3405d553
  1. hterm/
  2. kokoro/
  3. libdot/
  4. nassh/
  5. ssh_client/
  6. terminal/
  7. wasi-js-bindings/
  8. wassh/
  9. .clang-format
  10. .eslintrc.js
  11. .gitignore
  12. .markdownlintrc
  13. .npmrc
  14. .pylintrc
  15. CPPLINT.cfg
  16. DIR_METADATA
  17. Dockerfile
  18. HACK.md
  19. LICENSE
  20. METADATA
  21. navbar.md
  22. OWNERS
  23. package.json
  24. PRESUBMIT.cfg
  25. pyproject.toml
  26. README.md
  27. unblocked_terms.txt
README.md

Hello

This repository contains the libdot JavaScript library and some web applications that make use of it.

The official copy of this repository is hosted at https://chromium.googlesource.com/apps/libapps.

There is also a mirror on github at https://github.com/libapps/libapps-mirror. A few subprojects are also extracted out into their own git repo and mirrored. Keep in mind that these mirrors may occasionally be behind the official repository.

All changes must go through the Gerrit code review server on https://chromium-review.googlesource.com. Github pull requests cannot be accepted. Please see the HACK.md document in this directory for the details.

Top level directories

  • libdot/ is a small set of JS libraries initially developed as part of hterm, now available as shared code.

  • hterm/ is a JS library that provides a terminal emulator. It is reasonably fast, reasonably correct, and reasonably portable across browsers.

  • nassh/ is the Chrome Secure Shell extension that combines hterm with a build of OpenSSH to provide a PuTTY-like app for Chrome users.

  • ssh_client/ is the NaCl & WASM port of OpenSSH.

  • terminal/ is the ChromeOS Terminal application.

  • wassh/ is the JS part of the WASM OpenSSH port.

  • wasi-js-bindings/ provides JS bindings for WASI which is used by the WASM port.