diff --git a/server/Cargo.toml b/server/Cargo.toml index 6459060..e5e2abe 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -11,4 +11,5 @@ anyhow = "1.0" navka_common = { path = "../common" } tracing = { version = "0.1", features = ["std"] } tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] } -libc = "0.2" +libc = "0.2" +futures-util = "0.3" diff --git a/server/src/main.rs b/server/src/main.rs index 2e40115..3985bd0 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -2,12 +2,13 @@ // main.rs #![forbid(unsafe_code)] -use std::{pin::Pin, sync::Arc}; +use std::{pin::Pin, sync::Arc, panic::AssertUnwindSafe}; use tokio::{fs::{File, OpenOptions}, io::AsyncWriteExt, sync::Mutex}; use tokio_stream::{wrappers::ReceiverStream, Stream, StreamExt}; use tonic::{transport::Server, Request, Response, Status}; use tracing::{error, info, trace, warn, debug}; use tracing_subscriber::{fmt, EnvFilter}; +use futures_util::FutureExt; use navka_common::navka::{ relay_server::{Relay, RelayServer}, @@ -37,7 +38,7 @@ impl Relay for Handler { tokio::spawn(async move { // catch panics so that they are logged instead of killing the task silently - let task = std::panic::AssertUnwindSafe(async move { + let task = AssertUnwindSafe(async move { // perpetually read client → server messages while let Some(res) = in_stream.next().await { match res {