mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-28 03:43:23 +00:00
Refactor sock option implementations
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
782cd05ade
commit
f8eca84a99
@ -132,8 +132,9 @@ impl FileTable {
|
||||
.ok_or(Error::with_message(Errno::EBADF, "fd not exits"))
|
||||
}
|
||||
|
||||
pub fn get_socket(&self, sockfd: FileDescripter) -> Result<&dyn Socket> {
|
||||
self.get_file(sockfd)?
|
||||
pub fn get_socket(&self, sockfd: FileDescripter) -> Result<Arc<dyn Socket>> {
|
||||
let file_like = self.get_file(sockfd)?.clone();
|
||||
file_like
|
||||
.as_socket()
|
||||
.ok_or_else(|| Error::with_message(Errno::ENOTSOCK, "the fd is not a socket"))
|
||||
}
|
||||
|
Reference in New Issue
Block a user