mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(ext/net): make unix and tcp identical on close (#13075)
std/http/server knows how to handle "Listener has been closed" exceptions but not "operation canceled" errors. Make "unix" listen sockets throw the same exception as "tcp" listen sockets when the socket is closed and has a pending accept operation. There is still a discrepancy when multiple accept requests are posted but that's probably a less visible issue and something for another day. Fixes #13033
This commit is contained in:
parent
2c20e621aa
commit
4d176b7b7c
3 changed files with 22 additions and 13 deletions
|
@ -91,8 +91,11 @@ pub(crate) async fn accept_unix(
|
|||
.try_borrow_mut()
|
||||
.ok_or_else(|| custom_error("Busy", "Listener already in use"))?;
|
||||
let cancel = RcRef::map(resource, |r| &r.cancel);
|
||||
let (unix_stream, _socket_addr) =
|
||||
listener.accept().try_or_cancel(cancel).await?;
|
||||
let (unix_stream, _socket_addr) = listener
|
||||
.accept()
|
||||
.try_or_cancel(cancel)
|
||||
.await
|
||||
.map_err(crate::ops::accept_err)?;
|
||||
|
||||
let local_addr = unix_stream.local_addr()?;
|
||||
let remote_addr = unix_stream.peer_addr()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue