Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libshpool/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use super::{consts, tty};

const JOIN_POLL_DUR: time::Duration = time::Duration::from_millis(100);
const JOIN_HANGUP_DUR: time::Duration = time::Duration::from_millis(300);
const STDIN_POLL_DUR: time::Duration = time::Duration::from_millis(200);

/// The centralized encoding function that should be used for all protocol
/// serialization.
Expand Down Expand Up @@ -257,6 +258,7 @@ impl Client {
loop {
let nread = stdin.read(&mut buf).context("reading stdin from user")?;
if nread == 0 {
thread::sleep(STDIN_POLL_DUR);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind adding a comment here explaining that this is just a tmp mitigation until we can gracefully detach in the face of EOF.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think hanging up here may be as simple as just returning Ok(()). It looks like that breaks a few tests, though hopefully just for timing reasons, so it's not entirely trivial. We probably want to write a new test ensuring that shpool attach with a null stdin does create the session as you would expect and the early hangup doesn't cause trouble as well.

continue;
}
debug!("read {} bytes", nread);
Expand Down