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

fix: handle IPC unreadable socket #167

Merged
merged 2 commits into from
Jan 31, 2024
Merged
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
8 changes: 7 additions & 1 deletion crates/transport-ipc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,15 @@ where

// read more data into the buffer
match ready!(poll_read_buf(this.reader.as_mut(), cx, &mut this.buf)) {
Ok(0) => {
// stream is no longer readable and we're also unable to decode any more
// data. This happens if the IPC socket is closed by the other end.
// so we can return `None` here.
debug!("IPC socket EOF, stream is closed");
Copy link
Member

Choose a reason for hiding this comment

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

would consider making these traces

Copy link
Member Author

Choose a reason for hiding this comment

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

can do eventually, but for now this is useful on debug

return Ready(None);
}
Ok(data_len) => {
debug!(%data_len, "Read data from IPC socket");

// can try decoding again
*this.drained = false;
}
Expand Down
Loading