Skip to content

Commit

Permalink
Don't crash if the channel is closed.
Browse files Browse the repository at this point in the history
I hit this crash by closing the profiler tab immediately after it opened.
  • Loading branch information
mstange committed Dec 22, 2022
1 parent 6c8ae7d commit 8b92631
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions samply/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,13 @@ async fn symbolication_service(
if data_len == 0 {
break;
}
sender
let send_result = sender
.send_data(Bytes::copy_from_slice(&contents[..data_len]))
.await
.expect("couldn't send data");
.await;
if send_result.is_err() {
// The other side may have closed the channel. Stop sending.
break;
}
}
});
}
Expand Down

0 comments on commit 8b92631

Please sign in to comment.