Skip to content

Commit 476446f

Browse files
committed
Add comments for why VsockListener in async-server.
The code introduced by #38 was confused and seems like unnecessary. During some test, it could be removed, but it was decided to be kept for the compatibility and vsock-specific features maybe used in the future. Signed-off-by: Tim Zhang <[email protected]>
1 parent f115450 commit 476446f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/asynchronous/server.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ impl Server {
157157

158158
self.do_start(incoming).await
159159
}
160+
// It seems that we can use UnixStream to represent both UnixStream and VsockStream.
161+
// Whatever, we keep it for now for the compatibility and vsock-specific features maybe
162+
// used in the future.
160163
#[cfg(any(target_os = "linux", target_os = "android"))]
161164
Some(Domain::Vsock) => {
162165
let incoming = unsafe { VsockListener::from_raw_fd(listenfd).incoming() };
@@ -613,11 +616,7 @@ impl HandlerContext {
613616
})?;
614617
}
615618
task.await
616-
.unwrap_or_else(|e| {
617-
Err(Error::Others(format!(
618-
"stream {path} task got error {e:?}"
619-
)))
620-
})
619+
.unwrap_or_else(|e| Err(Error::Others(format!("stream {path} task got error {e:?}"))))
621620
.map_err(|e| get_status(Code::UNKNOWN, e))
622621
}
623622

0 commit comments

Comments
 (0)