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

Minor: avoid (likely unreachable) panic in FlightClient #5734

Merged
merged 1 commit into from
May 8, 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
12 changes: 8 additions & 4 deletions arrow-flight/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,10 +710,14 @@ impl<T, E> Stream for FallibleRequestStream<T, E> {
match ready!(request_streams.poll_next_unpin(cx)) {
Some(Ok(data)) => Poll::Ready(Some(data)),
Some(Err(e)) => {
// unwrap() here is safe, ownership of sender will
// be moved only once as this stream will not be polled
// again
let _ = pinned.sender.take().unwrap().send(e);
// in theory this should only ever be called once
// as this stream should not be polled again after returning
// None, however we still check for None to be safe
if let Some(sender) = pinned.sender.take() {
// an error means the other end of the channel is not around
// to receive the error, so ignore it
let _ = sender.send(e);
}
Poll::Ready(None)
}
None => Poll::Ready(None),
Expand Down
Loading