Skip to content

Commit

Permalink
SessionChannel: check for EPOLLHUP on tty
Browse files Browse the repository at this point in the history
This avoids one unnecessary read() system call.
  • Loading branch information
MaxKellermann committed Oct 23, 2023
1 parent 94ff3d5 commit 78ed118
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libcommon
7 changes: 7 additions & 0 deletions src/SessionChannel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ SessionChannel::OnRequest(std::string_view request_type,
void
SessionChannel::OnTtyReady([[maybe_unused]] unsigned events) noexcept
{
if (events == PipeEvent::HANGUP) {
tty.Close();
SendEof();
CloseIfInactive();
return;
}

std::byte buffer[4096];
std::span<std::byte> dest{buffer};

Expand Down

0 comments on commit 78ed118

Please sign in to comment.