mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
ws: don't panic when ConnectionWriter can't recv from closed channel
This commit is contained in:
parent
7df90171b1
commit
3986c0ec92
1 changed files with 3 additions and 5 deletions
|
|
@ -378,11 +378,9 @@ struct ConnectionWriter {
|
|||
impl ConnectionWriter {
|
||||
async fn run_out_message_loop(&mut self) -> anyhow::Result<()> {
|
||||
loop {
|
||||
let (meta, out_message) = self
|
||||
.out_message_receiver
|
||||
.recv()
|
||||
.await
|
||||
.expect("wait_for_out_message: can't receive out_message, sender is closed");
|
||||
let (meta, out_message) = self.out_message_receiver.recv().await.ok_or_else(|| {
|
||||
anyhow::anyhow!("ConnectionWriter couldn't receive message, sender is closed")
|
||||
})?;
|
||||
|
||||
if meta.naive_peer_addr != self.peer_addr {
|
||||
return Err(anyhow::anyhow!("peer addresses didn't match"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue