Repository navigation
Send the terminal resize off the main thread - #81
Merged
Merged
Conversation
onResize runs on the main thread, and the window-change it sent is network I/O, which Android refuses there. The SSH library had already encrypted the packet and advanced its sequence number before the write failed, so every later packet was out of step with the server, and the server closed the connection at the client's next packet: the reply to the C3X's 10-second keepalive probe, or the 5-second client keepalive on Proxmox. The resize now goes through the bridge's writer thread, the same one keystrokes use, so it is sent in order with them. Claude-Session: https://claude.ai/code/session_01CiTeuL5wrBa86ELAzASv4B
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause of the SSH drops after a resize
TerminalEmulatorcallsonResizeon the main thread, and the bridge sent the PTYwindow-changefrom there. Android refuses network I/O on the main thread. JSch had already encrypted the packet and advanced its outgoing sequence number before the socket write failed, andrunCatchinghid the error. Every later packet was then out of step with the server, which closed the connection at the client's next packet:last).Termux and non-terminal commands don't resize, so they were unaffected.
Change
The resize goes through the bridge's single
writerthread, the one keystrokes already use, so it is sent off the main thread and in order with typed input.The earlier experiments (#76 dedupe, #78 read/draw split, #79 zero pixels, #80 5-second keepalive) stay; they're harmless, and the keepalive still detects dead links within 30 s.
Test
On the C3X and Proxmox: connect, open and close the keyboard and a sheet, then leave it idle for a minute.
Generated by Claude Code