mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 00:43:24 +00:00
Pass can reuse to bind_socket
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
dc4df47007
commit
434f143e30
@ -30,6 +30,7 @@ impl InitStream {
|
||||
pub fn bind(
|
||||
self,
|
||||
endpoint: &IpEndpoint,
|
||||
can_reuse: bool,
|
||||
) -> core::result::Result<AnyBoundSocket, (Error, Self)> {
|
||||
let unbound_socket = match self {
|
||||
InitStream::Unbound(unbound_socket) => unbound_socket,
|
||||
@ -40,7 +41,7 @@ impl InitStream {
|
||||
));
|
||||
}
|
||||
};
|
||||
let bound_socket = match bind_socket(unbound_socket, endpoint, false) {
|
||||
let bound_socket = match bind_socket(unbound_socket, endpoint, can_reuse) {
|
||||
Ok(bound_socket) => bound_socket,
|
||||
Err((err, unbound_socket)) => return Err((err, InitStream::Unbound(unbound_socket))),
|
||||
};
|
||||
@ -52,7 +53,7 @@ impl InitStream {
|
||||
remote_endpoint: &IpEndpoint,
|
||||
) -> core::result::Result<AnyBoundSocket, (Error, Self)> {
|
||||
let endpoint = get_ephemeral_endpoint(remote_endpoint);
|
||||
self.bind(&endpoint)
|
||||
self.bind(&endpoint, false)
|
||||
}
|
||||
|
||||
pub fn connect(
|
||||
|
Reference in New Issue
Block a user