Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow Control #631

Open
bmaurer opened this issue Apr 27, 2024 · 5 comments
Open

Flow Control #631

bmaurer opened this issue Apr 27, 2024 · 5 comments

Comments

@bmaurer
Copy link

bmaurer commented Apr 27, 2024

I've noticed that ET struggles with Flow Control. If you run

cat /dev/zero | base64 -w 0

it is not possible to send a ^C to the server. Using SSH directly it works fine.

@bmaurer
Copy link
Author

bmaurer commented Apr 27, 2024

$ et --version
et version 6.2.1

@MisterTea
Copy link
Owner

ET has flow control but it's based on lines-per-second (currently set to 1024 lines-per-second):

https://github.com/MisterTea/EternalTerminal/blob/master/src/terminal/UserTerminalHandler.cpp#L110

In your example, there are no newlines so the flow control doesn't kick in. Feel free to change the logic to do roughly 80k characters per second and that would fix the example you posted.

@bmaurer
Copy link
Author

bmaurer commented May 4, 2024

@MisterTea This also repros if you just run cat /dev/zero | base64, which has plenty of newlines.

@MisterTea
Copy link
Owner

Oh, interesting! What happens if you compile with a much lower lines per second?

@bmaurer
Copy link
Author

bmaurer commented May 7, 2024

Haven't had a chance to try out an end to end compile. This python script might be helpful though:

from datetime import datetime
while True:
  print(( datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') + "\n") * 1000)

When run through ET, you can see that the time that gets printed out starts lagging real time. This suggests that ET is not putting back pressure on the stdout of the underlying process. OTOH with SSH directly, everything is in real time.

Intuitively, if you have a rate limit (ideally this would not be necessary. 1024 lines / second is rather slow if you cat a long file) you also need to put backpressure on the remote end. If you allow buffering, you are always going to be seeing old output, which means that a control-C can't take effect instantly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants