mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-10 13:56:48 +00:00
Remove the redundant bound_socket()
from ListenStream
There is no need to get the bound socket by cloning the first element from `self.backlog_sockets`. If we want a bound socket, we can always use `self.bound_socket` directly.
This commit is contained in:
parent
0cc9c5fb3a
commit
bc771de494
@ -105,7 +105,7 @@ impl ListenStream {
|
||||
}
|
||||
|
||||
pub fn local_endpoint(&self) -> Result<IpEndpoint> {
|
||||
self.bound_socket()
|
||||
self.bound_socket
|
||||
.local_endpoint()
|
||||
.ok_or_else(|| Error::with_message(Errno::EINVAL, "does not has remote endpoint"))
|
||||
}
|
||||
@ -114,10 +114,6 @@ impl ListenStream {
|
||||
self.pollee.poll(mask, poller)
|
||||
}
|
||||
|
||||
fn bound_socket(&self) -> Arc<AnyBoundSocket> {
|
||||
self.backlog_sockets.read()[0].bound_socket.clone()
|
||||
}
|
||||
|
||||
fn update_io_events(&self) {
|
||||
// The lock should be held to avoid data races
|
||||
let backlog_sockets = self.backlog_sockets.read();
|
||||
|
Loading…
x
Reference in New Issue
Block a user