Skip to content

Commit 1ec9ea3

Browse files
committed
io_uring: fix 3075d49: catch timeout properly
1 parent 3075d49 commit 1ec9ea3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/io_uring.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ pub async fn io_loop(
168168

169169
// Asynchronously wait for an inbound TCP connection
170170
let retval = listener.accept();
171-
let (stream, addr) = match timeout(TCP_CLIENT_TIMEOUT, retval).await? {
172-
Ok((stream, addr)) => (stream, addr),
173-
Err(_) => {
174-
error!(
175-
"{} 📵 TCP server: timed out waiting for phone connection, restarting...",
176-
NAME
177-
);
171+
let (stream, addr) = match timeout(TCP_CLIENT_TIMEOUT, retval)
172+
.await
173+
.map_err(|e| std::io::Error::other(e))
174+
{
175+
Ok(Ok((stream, addr))) => (stream, addr),
176+
Err(e) | Ok(Err(e)) => {
177+
error!("{} 📵 TCP server: {}, restarting...", NAME, e);
178178
// notify main loop to restart
179179
need_restart.notify_one();
180180
continue;

0 commit comments

Comments
 (0)