Fix error codes in bind, listen, and accept

This commit is contained in:
Ruihan Li
2024-01-09 23:41:52 +08:00
committed by Tate, Hongliang Tian
parent 346887ace5
commit 92a9f5616e
7 changed files with 132 additions and 27 deletions

View File

@ -77,7 +77,7 @@ impl IfaceCommon {
return Ok(port);
}
}
return_errno_with_message!(Errno::EAGAIN, "cannot find unused high port");
return_errno_with_message!(Errno::EAGAIN, "no ephemeral port is available");
}
fn bind_port(&self, port: u16, can_reuse: bool) -> Result<()> {
@ -86,7 +86,7 @@ impl IfaceCommon {
if *used_times == 0 || can_reuse {
*used_times += 1;
} else {
return_errno_with_message!(Errno::EADDRINUSE, "cannot bind port");
return_errno_with_message!(Errno::EADDRINUSE, "the address is already in use");
}
} else {
used_ports.insert(port, 1);