Skip to content

Commit b2004f7

Browse files
authored
Merge pull request #177 from Tim-Zhang/add-important-comments
Add comments for why VsockListener in async-server.
2 parents f115450 + 476446f commit b2004f7

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)