-
Notifications
You must be signed in to change notification settings - Fork 245
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
Conversation
8c597ff
to
9917290
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 this makes sense—we should just be able to drop the stream if we have no more data indicated by Ready(0)
.
crates/transport-ipc/src/lib.rs
Outdated
@@ -196,6 +196,14 @@ where | |||
Ok(data_len) => { | |||
debug!(%data_len, "Read data from IPC socket"); | |||
|
|||
if data_len == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mild preference to make this an Ok(0) match arm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// 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"); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
This handles the case when the ipc socket is no longer readable and poll read returns Ready(0), in which case we can terminate the stream.
This happens when the node is terminated.