Skip to content

Commit

Permalink
Do not panic when join handle is canceled
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Aug 26, 2024
1 parent fb1f4e1 commit 70c8183
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tunnel-obfuscation/src/shadowsocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,11 @@ impl Obfuscator for Shadowsocks {
}

async fn run(self: Box<Self>) -> crate::Result<()> {
self.server
.await
.expect("server handle panicked")
.map_err(crate::Error::RunShadowsocksObfuscator)
match self.server.await {
Ok(result) => result.map_err(crate::Error::RunShadowsocksObfuscator),
Err(_err) if _err.is_cancelled() => Ok(()),
Err(_err) => panic!("server handle panicked"),
}
}

#[cfg(target_os = "android")]
Expand Down

0 comments on commit 70c8183

Please sign in to comment.