mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 18:55:32 +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 {
|
impl ConnectionWriter {
|
||||||
async fn run_out_message_loop(&mut self) -> anyhow::Result<()> {
|
async fn run_out_message_loop(&mut self) -> anyhow::Result<()> {
|
||||||
loop {
|
loop {
|
||||||
let (meta, out_message) = self
|
let (meta, out_message) = self.out_message_receiver.recv().await.ok_or_else(|| {
|
||||||
.out_message_receiver
|
anyhow::anyhow!("ConnectionWriter couldn't receive message, sender is closed")
|
||||||
.recv()
|
})?;
|
||||||
.await
|
|
||||||
.expect("wait_for_out_message: can't receive out_message, sender is closed");
|
|
||||||
|
|
||||||
if meta.naive_peer_addr != self.peer_addr {
|
if meta.naive_peer_addr != self.peer_addr {
|
||||||
return Err(anyhow::anyhow!("peer addresses didn't match"));
|
return Err(anyhow::anyhow!("peer addresses didn't match"));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue